Class Task {
    puplic:
2intadd(intx,inty){
3return(x + y); }
4int  incr(int i){
5i=i+1;}
6voidfun() {
7intsum=0;
8inti=1;
9    while(i < 11){
10     sum=add(sum,i ) ;
11     i=incr(i) ; }
12     cout<< SUM=<<sum;
}
main ( ) {
   Taskob;
1 ob.fun ( ) ;
   }
Algorithm 1: An object-oriented program.