Write a program of multilevel inheritance


 

/* Write a program of multilevel 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 c::public b

{

public:

void print()

{

cout<<“print”;

}};

void main()

{

clrscr();

class c c1;

c1.dis();

c1.show();

c1.print();

getch();

}

/* output:

dis

show

print*/

Related Posts

Comments are closed.