The presence of Multiple Inheritance in a language raises subtle problems related to possible ambiguities. To avoid handling these difficulties, many languages, including Java, do not support multiple inheritance. This paper studies the problem of implementing multiple inheritance in a class-based language that does not provide it. In particular we propose an experimental extension of Java, M-Java, which enables multiple inheritance, and a precompilation process translating M-Java programs into standard Java programs. This translation process is automatic and transparent to the programmer. The distinguishing feature of our proposal is that crucial semantic aspects of multiple inheritance, related to overriding and subtyping, are preserved by the translation process. We show that such aspects are not preserved in other alternative solutions, presented in the literature, which rely on simulating multiple inheritance by delegation techniques. We will also show that, due to language features, some problems still arise concerning protected methods.
On Multiple Inheritance in Java.
Michele LORETI;
2003-01-01
Abstract
The presence of Multiple Inheritance in a language raises subtle problems related to possible ambiguities. To avoid handling these difficulties, many languages, including Java, do not support multiple inheritance. This paper studies the problem of implementing multiple inheritance in a class-based language that does not provide it. In particular we propose an experimental extension of Java, M-Java, which enables multiple inheritance, and a precompilation process translating M-Java programs into standard Java programs. This translation process is automatic and transparent to the programmer. The distinguishing feature of our proposal is that crucial semantic aspects of multiple inheritance, related to overriding and subtyping, are preserved by the translation process. We show that such aspects are not preserved in other alternative solutions, presented in the literature, which rely on simulating multiple inheritance by delegation techniques. We will also show that, due to language features, some problems still arise concerning protected methods.I documenti in IRIS sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.