Abstract
Multiple inheritance is a feature whose worth has been vigorously debated, and even now there is no agreement as to whether a language should include it. Java does not have multiple inheritance, but its designers claim that many of the benefits of multiple inheritance can be gained through the use of a new feature, the interface. In this paper we explore the claims of the Java designers, and show how the interface may be used to simulate multiple inheritance. We first discuss the benefits of inheritance and multiple inheritance, and then demonstrate how the need for them arises in program development, using an extended example based on a real application. We then present the technique for simulating multiple inheritance, showing how it allows the main benefits of multiple inheritance to be achieved in Java. Finally, we discuss the limitations of the approach. In particular, we show how the approach faces difficulties when used with class libraries, such as the Java Core API, and we suggest a convention for Java class library designers that will mitigate this problem.
Published Version
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have