#include <iostream>
using namespace std;
class rect
{
int length;
int breadth;
public:
rect(int l,int b)
{
length=l;
breadth=b;
}
int getArea()
{
return length*breadth;
}
};
int main()
{
rect obj1(5,9);
cout << obj1.getArea() << endl;
rect*ptr=&obj1;
cout<<"This is area : "<<ptr ->getArea();
}
Note: Need to be arranged in compiler after copied
OutPut:
45
This is area :45
This is area :45