Wednesday, 21 April 2021

Inheritance in C++ Qus - 2

 #include<iostream.h>

#include<conio.h>

class A

{

public:

A()

{

cout<<"C-A"<<endl;

}

~A()

{

cout<<"D-A"<<endl;

}

};

class B:A

{

public:

B()

{

cout<<"C-B"<<endl;

}

~B()

{

cout<<"D-B"<<endl;

}

};

class C:B

{

public:

C()

{

cout<<"C-C"<<endl;

}

~C()

{

cout<<"D-C"<<endl;

}

}

int main()

{

clrscr();

{

C ob;

}

getch();

return 0;

}

No comments:

Post a Comment