My photo
Bangalore, Karnataka, India
Extending one hand to help someone has more value rather than joining two hands for prayer

Archives

program to show the basics of inline function in oops

Tuesday, September 1, 2009

#include<iostream.h>
#include<conio.h>
class rectangle
{
 int a,b;
 public:
       void setdata(int x,int y)
       {
    a=x;
    b=y;
    }
    void show()
    {
    cout<<"area of rectangle is "<<a*b;
    }
};
void main()
{
 clrscr();
 rectangle r1,r2,r3;
 r1.setdata(7,6);
 r1.show();
 cout<<endl;
 r1.setdata(5,5);
 r2.setdata(10,10);
 r2.show();
 cout<<endl;
 r1.show();
 getch();
 }

0 comments: