write a program to demonstrate,how constructor and
deconstructor work under multilevel inheritance

Answer Posted / kunalsahu

#include<iostream.h>
#include<conio.h>

class a
{
//Data
public:
a()
{
cout<<"class A Constructor\n" ;
}
~a()
{
cout<<"class A Destructor"<<endl;
}
};
class b:public a
{
//Data
public:
b()
{
cout<<"class B Constructor"<<endl;
}
~b()
{
cout<<"class B Destructor"<<endl;
}

};
class c:public b
{
//Data
public:
c()
{
cout<<"class C Constructor"<<endl;
}
~c()
{
cout<<"class C Destructor"<<endl;
}
};
int main()
{ clrscr();
//c *pCObj;
//pCObj=new c();
c k;
getch();
return 0;
}


/*O/p:
class A Constructor
class B Constructor
class C Constructor
class C Destructor
class B Destructor
class A Destructor */

Is This Answer Correct ?    7 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is stl open source?

629


help me i need a c++ program which takes sequesnce of characters and outputed sequence of their token taypes, work same compiler in lexical analysis phase

1879


What is meant by stl in c++?

652


sir please send me bpcl previous question papers

1952


What is stl stand for?

736






Is string part of stl?

674


What does stl mean in slang?

647


What are the various types of stl containers?

727


what is template and type convertion

1992


Why should a c++ programmer be interested in stl?

638


totoo po ba ang manga aliens!

2333


draw a flowchart that accepts two numbers and checks if the first is divisible by the second.

2856


What is a list in c++ stl?

689


please visit this site you'll find my question this is my homework please answer it if you can http://easyscience.org/ib/lofiversion/index.php/t36168.html

1774


What is stl in oop?

675