1. In most cases, tree-structured organization of classes is adequate to describe applications. In such cases, all superclasses of a class are ancestors of descendants of another in the hierarchy. However, there are situations that cannot be represented well in a tree-structured class hierarchy.
2. Example. We could create subclasses: part-time-teller, full-time-teller, etc., as shown in Fig. 8.4. But problems: (1) redundancy leads to potential inconsistency on updates; and (2) the hierarchy cannot represent full/part- time employees who are neither secretaries nor tellers.
3. Multiple inheritance: the ability of class to inherit variables and methods from multiple superclasses.
4. The class/subclass relationship is represented by a rooted directed acyclic graph (DAG) in which a class may have more than one superclass.
5. Handling name con
icts: When multiple inheritance is used, there is potential ambiguity if the same variable or method can be inherited from more than one superclass.
6. Example. In our banking example, we may define a variable pay for each full-time, part-time, teller and secretary as follows:
- full-time: pay is an integer from 0 to 100,000 containing annual salary.
- part-time: pay is an integer from 0 to 20 containing an hourly rate of pay.
- teller: pay is an integer from 0 to 20,000 containing the annual salary.
- secretary: pay is an integer from 0 to 25,000 containing the annual salary.

7. For part-time-secretary, it could inherit the definition of pay from either part-time or secretary. We have the following options:
- Include both variables, renaming them to part-time-pay and secretary-pay.
- Choose one or the other based on the order of creation.
- Force the user the make a choice at the time of class definition.
- Treat the situation as an error.
No single solution has been accepted as best, and di erent systems make di erent choices.
8. Not all cases of multiple inheritance lead to ambiguity. If, instead of defining pay, we retain the definition of variable salary in class employee, and define it nowhere else, then all the subclasses inherit salary from employee (no ambiguity).
9. We can use multiple inheritance to model the concept of roles. For example, for subclasses, student, teacher and footballPlayer, an object can belong to several categories at once and each of these categories is called a role. We can use multiple inheritance to create subclasses, such as student-teacher, student-footballPlayer,and so on to model the possibility of an object simultaneously having multiple roles.
