October 1997
Intermediate to advanced
800 pages
20h 48m
English
No doubt about it, multiple inheritance is controversial. Arguments abound concerning its use, overhead, overuse, and potential for ambiguities. In fact, workarounds that avoid multiple inheritance are possible. In this chapter, however, our goal is to explore multiple inheritance in C++.
Suppose an athlete plays baseball and football. If he's good enough, he can play baseball in the major leagues and football in the NFL. Since this person plays both sports (and makes the big bucks, too), it's easy to model a multisport player as shown in Figure 14.1.
In this OMT diagram, MultiSportPlayer derives from both BaseballPlayer and FootballPlayer.