Chapter 25
Inheriting Multiple Inheritance
In This Chapter
Introducing multiple inheritance
Avoiding ambiguities with multiple inheritance
Avoiding ambiguities with virtual inheritance
Figuring out the ordering rules for multiple constructors
Getting a handle on problems with multiple inheritance
In the class hierarchies discussed in other chapters, each class inherits from a single parent. Such single inheritance is sufficient to describe most real-world relationships. Some classes, however, represent the blending of multiple classes into one. (Sounds sort of romantic, doesn't it?)
An example of such a class is the sleeper sofa that creates the unbeatable combination of a harsh bed and an uncomfortable sofa. To adequately describe a sleeper sofa in C++, the sleeper sofa should be able to inherit both bed- and sofa-like properties. This is called multiple inheritance.
Describing the Multiple Inheritance Mechanism
Figure 25-1 shows the inheritance graph for class SleeperSofa that ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access