PROGRAM TO SHOW THE CONCEPT OF CONTAINER CLASS

/*PROGRAM TO SHOW THE CONCEPT OF CONTAINER CLASS*/

#include<conio.h>

#include<iostream.h>

class A

{

int a;

public:

void get_a()

{

cout<<“Enter a: “;

cin>>a;

cout<<“a= “<<a;

}

};

class B

{

int b;

public:

void get_b()

{

cout<<“\nEnter b: “;

cin>>b;

cout<<“b= “<<b<<endl;

}

};

class C

{

A a1;

B b1;

int c;

public:

void get_c()

{

a1.get_a();

b1.get_b();

cout<<“Enter c: “;

cin>>c;

cout<<“c= “<<c<<endl;

}

};

void main()

{

C c1;

clrscr();

c1.get_c();

getch();

}

Leave a Reply

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