Type in (or use the online code) for the diamond-shaped hierarchy example in this chapter that uses

Question:

Type in (or use the online code) for the diamond-shaped hierarchy example in this chapter that uses virtual base classes. Run it as is. Hint: you may want to add explicit destructors with cout statements to trace the destruction sequence:

1. How many rifeForm subobjects exist for the instance of Centaur?

2. How many times is the tifeForm constructor (and destructor) invoked? Hint: you may want to place trace statements using cout in each of your constructors and destructor.

3. Which LifeForm constructor would be invoked if the constructor selections for LifeForm in the member initialization list of the centaur constructors were omitted?

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer: