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


Please Help Members By Posting Answers For Below Questions

What is the stl, standard template library?

818


Q1. A. What is unary operator? List out the different operators involved in the unary operator. B. What is an adjust field format flag? Q2. A. Distinguish between a # include and #define. B. Can a list of string be stored within a two dimensional array? Q3. A.Explain how a pointer to function can be declared in C++? B.List the merits and demerits of declaring a nested class in C++? Q4. A. What are the syntactic rules to be avoid ambiguity in multiple inheritence? B. Explain the operation of overloading of an assignment operator. Q5. A. Explain how the virtual base class is different from the conventional base classes of the opps. B. Explain how an exception handler is defined and invoked in a Program. Q6. A. What is a binary file? List the merits and demerits of the binary file usagein C++. B. Write short notes on Text Manipulation Routines. C. Write bites in Turbo c++ Header (“Include”) Files.

2525


Who created stl?

861


write a program to convert a decimal number in to its equivalent binary number?

2266


What is a stl vector?

819


What is meant by stl in c++?

875


How connect plc and pc through software

2150


What is a standard template library (stl)?

826


Describe how to safeguard a system through acquisition of an antivirus Program and systematic backup.

1855


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

2096


What is stl in oop?

929


How is stl different from c++ standard library?

954


What is stl in c++ with example?

836


Is string part of stl?

940


What is stl language?

849