//PROGRAM TO IMPLEMENT PARAMETERIZED CONSTRUCTOR
#include<iostream.h>
#include<conio.h>
class area
{
int length,breadth;
public:
area(int l,int b)
{
length=l;
breadth=b;
cout<<"Length of rectangle is:"<<length<<endl;
cout<<"Breadth of rectangle is: "<<breadth<<endl;
}
void display()
{
cout<<"Area of rectangle is: "<<length*breadth;
}
};
void main()
{
clrscr();
area a1(8,7);
a1.display();
getch();
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.