Understanding multiple inheritance mechanics
In C++, a class can have more than one immediate base class. This is known as multiple inheritance, and is a very controversial topic in both OO designs and OOP. Let’s begin with the simple mechanics; we will then move forward to the design issues and programming logistics surrounding MI during the progression of this chapter.
With multiple inheritance, the derived class specifies who each of its immediate ancestors or base classes are, using the base class list in its class definition.
In a similar fashion to single inheritance, the constructors and destructors are invoked all the way up the hierarchy as objects of the derived class type are instantiated and destroyed. Reviewing and expanding upon the subtleties of construction and destruction for MI, we are reminded of the following logistics:
- The calling sequence for a constructor starts with the derived class, but immediately passes control to a base constructor...