Write a program of hybrid inheritance


 

/* Write a program of hybrid inheritance*/

#include<iostream.h>

#include<conio.h>

class a

{

public:

void dis()

{

cout<<“dis”<<endl;

}

};

class b:public a

{

public:

void show()

{

cout<<“show”<<endl;

}

};

class d

{

public:

void create()

{

cout<<“create”<<endl;

}

};

class c:public d,public b

{

public:

void print()

{

cout<<“print”;

}

};

void main()

{

clrscr();

class c c1;

c1.dis();

c1.show();

c1.create();

c1.print();

getch();

}

/*output:

dis

show

create

print*/

Related Posts

Comments are closed.