Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

how to making game in c++ ?

2655


Is there any error below, its a code to delete all entires from a map #include #include iostream.h int main() { int i =0; map TestMap; while(i<3) { TesMap.insert(TestMap::value_type(i,Test)); i++; } typedef map :: iterator mapIter =TestMap.begin(); if(mapIter!=TestMap.end()) { TestMap.erase(mapItrer); ++mapIter; } return 0; }

2337


how can u do connectivity in c++ language? plz send me connectivity code in c++ ?

2270


What are the different types of stl containers?

1075


What are stl algorithms?

1116


What is stl stand for?

1162


Who wrote stl?

1080


Is stl open source?

1090


What are the various types of stl containers?

1109


How does an stl file work?

1095


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

2048


Define stl.

1219


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.

1896


What is the use of stl?

1044


What is stl stack?

1071