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

Can we use stl in coding interviews?

1290


sir please send me bpcl previous question papers

1963


What is stl stand for?

742


How stl is different from the c++ standard library?

652


How is stl different from c++ standard library?

752






What is a standard template library (stl)?

653


write a program that will accept a number and print.its equivalent in words the maximum input number is 9999

2507


how to making game in c++ ?

2185


To modify an, existing worksheet. What steps are involved for: 1. Inserting and deleting rows and columns. 2. Printing cell formulas 3Jld displayed values 3. Using the page setup command

1787


What is stl in c++ with example?

642


What is the stl, standard template library?

600


What does stl mean in slang?

656


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

1783


What are stl algorithms?

632


What is stl in oop?

690