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

What is a standard template library (stl)? What are the various types of stl containers?

776


i wanted to know about questions about c,c++ , which is required for placements.... im a fresher

1796


Can we use stl in coding interviews?

1391


What does stl stand for in basketball?

728


What does stl mean in slang?

730






Is stl open source?

720


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

725


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

729


How does an stl file work?

748


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

1867


What are the various types of stl containers?

832


What are the symptoms of stl?

700


What is a list in c++ stl?

784


Name the different types of stl containers.

791


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

1985