Suppose class Child is derived from class Parent that was in turn derived from class GrandParent. This question concerns order of calls to constructors and destructors for these three classes. Declare an object of class Child. We know that Child, Parent and GrandParent constructors are called. In what order are these constructors are called? When the time comes to destroy the class Child object, we know that Child, Parent and GrandParent destructors are called. In what order are these destructor called?

What will be an ideal response?

The constructors are called starting with the constructor for the ultimate base
class, class GrandParent, then the first derived class, class Parent, then
the object’s class, class Child. At destruction of the Child object, destructors are
called in reverse order of their invocation.

Computer Science & Information Technology

You might also like to view...

What is NOT an advantage of an enum class over a standard enum?

a. Doesn’t map to an integer b. Values are not global in scope c. Occupies less memory

Computer Science & Information Technology

Describe the setup in which a dual-homed host is used.  What are the limitations of this configuration?

What will be an ideal response?

Computer Science & Information Technology