2:29 PM
Develop a Program for delegation concept in c++

Develop a Program for delegation concept in c++ ? (Run in Dev C++)

#include<iostream>
#include<conio.h>
using namespace std;
class xyz{
public:
virtual void show()
{
cout<<"object xyz"<<endl;
}
};
class aa:public xyz{
public:
void show()
{
cout<<"object aa"<<endl;
}
};
class abc
{
public:
xyz *a;
abc(xyz *new_a)
{
a=new_a;
}
void show()
{
a->show();}
};
main()
{
xyz x;
aa a;
abc b1(&x);
abc b2(&a);
b1.show();
b2.show();
getch();
}
 
 
 
Output:
 
object xyz
object aa
 
Description: 
 
This program is made for clear the concept of delegation in c++. in which if complex class is distorted even than individual classes are existing.
 
(by Dr. Ayush Vashishtha )
Views: 162 | Added by: vijoriya | Tags: develop, c++, Delegation, program, Concept | Rating: 0.0/0
Total comments: 0
avatar