write a program to demonstrate,how constructor and
deconstructor work under multilevel inheritance
Answer Posted / archana
class a
{
//Data
public:
a(){cout<<"class A Constructor"<<endl}
~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()
{
c *pCObj;
pCObj = new c();
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 ? | 8 Yes | 9 No |
Post New Answer View All Answers
What is stl in oop?
What are the various types of stl containers?
How is stl different from c++ standard library?
Do you like to Submit Questions in Bulk under Same Category?? Then use our Bulk ListerDo you like to Submit Questions in Bulk under Same Category?? Then use our Bulk Lister
sir please send me bpcl previous question papers
How do I convert a stl file?
What is stl stand for?
how to use C++?
Is there any error below, its a code to delete all entires from a map #include
In what scenario does the Logical file and Physical file being used?
What is the use of stl?
What is a list in c++ stl?
draw a flowchart that accepts two numbers and checks if the first is divisible by the second.
Explain stl.
When did c++ add stl?