//Program to understand the concept of constuctor

| |


#include<iostream.h>
#include<conio.h>
class rectangle
{
private:
int length, breadth;
public:
rectangle(int a,int b)
{
length=a; breadth=b;
}
int area()
{
return(length*breadth);
}
};
int main()
{
rectangle r1(5,6);
rectangle r2(7,8);
cout<<"\nArea of reatangle 1="<<r1.area();
cout<<"\nArea of rectangle 2="<<r2.area();
return 0;
}
<