PROGRAM TO IMPLEMENT PARAMETERIZED CONSTRUCTOR

/*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();

}

Leave a Reply

Your email address will not be published. Required fields are marked *