|
|
|
|
Single vs. Multiple InheritanceJava allows a class to inherit from only a single superclass. This is called single inheritance. In contrast, C++ supports both single and multiple class inheritance. Experience has shown, however, that using multiple inheritance is often problematic; it is very complex, rife with pitfalls, and is one of the most difficult and non-intuitive features of that language. Using uncontrolled multiple inheritance can be dangerous to your sanity! However, Java does allow a class to implement many interfaces. We say that Java supports:
As a result, Java avoids the horrible problems of generalized multiple inheritance.
|
|
This page was last modified on 02 October, 2007 |