PROGRAM TO IMPLEMENT DEFAULT CONSTRUTOR

/*PROGRAM TO IMPLEMENT DEFAULT CONSTRUTOR*/

#include<conio.h>

#include<iostream.h>

class area

{

int l,b;

public:

area()

{

cout<<“Enter length of rectangle: “;

cin>>l;

cout<<“Enter breadth of rectangle: “;

cin>>b;

}

void display()

{

cout<<“Area is: “<<l*b;

}

};

void main()

{

clrscr();

area a1;

a1.display();

getch();

}

Leave a Reply

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