What happens while a derived-class object is developed, C/C++ Programming

What happens while a derived-class object is developed & destroyed?

A: Space is allocated (on the heap or the stack) for the full object (i.e. adequate space to store the data members inherited from the base class as well as the data members defined in derived class itself)

The constructor of base class is called to initialize the data members which inherited from the base class

Then the derived class's constructor is called to initialize data members added within the derived class

Then the derived-class object is usable

While the object is destroyed (goes out of scope or it is deleted) the derived class's destructor is called on the object first

The base class's destructor is then called on the object lastly the allocated space for the full object is reclaimed

 

Posted Date: 3/16/2013 3:04:25 AM | Location : United States







Related Discussions:- What happens while a derived-class object is developed, Assignment Help, Ask Question on What happens while a derived-class object is developed, Get Answer, Expert's Help, What happens while a derived-class object is developed Discussions

Write discussion on What happens while a derived-class object is developed
Your posts are moderated
Related Questions
what are the significances of scope resolution operator? Illustrate with example

hwat is the area fsdjlakl;aeklfjtealrtl;gka

In which condition a template a better solution than a base class? A: While you are designing a generic class to contain or manage objects of other types, while the format & beh

Operation on String - C ++ Program: Write a program to define operations on string in c++. class String {    char *char_ptr;   // pointer to string contents    int le

Pls i only need help with program 2. #include #include using namespace std; int main() { int FilingStatus; cout cout cout cout cout cout

Explain Rules for constructing variable names? The Rules for constructing variable names : a) A variable name is any combination of alphabets, 0 to 9 digits and undersc

6999066263304447777077766622337778 -----> message sent by the first smuggler. my name is robert---------> message decoded by the second smuggler. Where ‘0’ denotes the "space".

Inheritance is the process of forming new classes, called derived classes, from existing classes or base classes. The derived class inherits all the capabilities of the base class,

Write a function that has a single int parameter n and returns an int: 0 if n is negative, otherwise 1. You are not allowed to simply check the integer value, and should use the fu

Write a recursive function recursiveMin that takes an integer array, a starting subscript and an ending subscript as arguments, and returns the smallest element in the array. The