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

Assignment Help:

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

 


Related Discussions:- What happens while a derived-class object is developed

Explain object conversions, Object Conversions Just like initialization...

Object Conversions Just like initialization, conversions are also done automatically when an object of a derived class is assigned to an object of the base class. Though, the c

Arrays, #questi An array of n numbers is given, where n is an even number. ...

#questi An array of n numbers is given, where n is an even number. The maximum as well as minimum of these given numbers need to be determined. Which of the following is true about

Data structure and algorithm, implement two stacks in one array A[1...n] in...

implement two stacks in one array A[1...n] in such a way that neither stack overflows unless the total number of elements in both stacks together is n. For this you need to produce

What do you mean by inheritance, Inheritance is the process of forming new ...

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,

Pebble merchent problem, There is a pebble merchant. He sells the pebbles, ...

There is a pebble merchant. He sells the pebbles, that are used for shining the floor. His main duty is to take the length of the room’s sides. But he sometimes mistakes doing that

Flowchart, questiCreate a flowchart that displays the student''''s average ...

questiCreate a flowchart that displays the student''''s average score for three quizzes. + Assume that there are 3 sections each having 5 students + The only valid number to be en

Applied scientific computing in c++, i have a project that is due this Wedn...

i have a project that is due this Wednesday and i was wondering if i can get help in doing it?

Decode the Code, Smugglers are becoming very smart day by day. Now they hav...

Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new technology, they are send

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd