PROGRAM TO SHOW THE CONCEPT OF NESTING OF MEMBER FUNCTIONS

/*PROGRAM TO SHOW THE CONCEPT OF NESTING OF MEMBER FUNCTIONS*/

#include<conio.h>

#include<iostream.h>

class nest_fun

{

int l,b,area;

public:

void input();

void output(int,int);

};

void nest_fun::input()

{

cout<<“Enter length and breadth of rectangle: “;

cin>>l>>b;

output(l,b);

}

void nest_fun::output(int l,int b)

{

cout<<“Length = “<<l<<” Breadth= “<<b<<endl;

area=l*b;

cout<<“Area of rectangle: “<<area;

}

void main()

{

nest_fun n1;

clrscr();

n1.input();

getch();

}

Leave a Reply

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