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
how to making game in c++ ?
Is there any error below, its a code to delete all entires from a map #include
how can u do connectivity in c++ language? plz send me connectivity code in c++ ?
What are the different types of stl containers?
What are stl algorithms?
What is stl stand for?
Who wrote stl?
Is stl open source?
What are the various types of stl containers?
How does an stl file work?
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
Define stl.
a program using one dimensional array that searches a number if it is found on the list of given input numbers given by the user and locate its exact location in the list.
What is the use of stl?
What is stl stack?