Multiple Inheritance

What's the Big Deal?

Usually the term "multiple inheritance" refers to a class being derived from, or extending, multiple classes. This is a much-debated feature -- some languages have it, some do not. A lot of people hate it! The problem is that classes can have implementation, and implementation inheritance has a lot of ambiguities associated with it; it turns out to be very complex and messy. Java does not have this: a class can only extend one superclass.

Consider

mi.gif

and assume that d is an object of class D. We have quite a few decisions to make.

Interface Inheritance doesn't have these ambiguities

Since the methods in an interface don't have bodies, a class implementing multiple interfaces has only one implementation for a method even when there appears to be a name clash!

Java note: In Java you can put constants (static final fields) in interfaces. If these clash, you need to cast an object to an interface before using the field.