Darryl L. Pierce wrote:
> You cannot do that. Java does not support multiply inheritence of
> *implementation*.
>
> However, if you were to make A, B and C _interfaces_, then D could
> implement both B and C. Then, using patterns (such as
> Wrapper/Decorator), you could do the following:
>
> A--extended by-->B--implemented by-->Bimpl
> A--extended by-->C--implemented by-->Cimpl
>
> D--extends both-->[B,C]--contains instances of-->[Bimpl,Cimpl]
>
> Then your D could pass calls to those methods defined in the A, B and C
> interfaces to the specific instance variables of tyep Bimpl and Cimpl
> as necessary.
>
In our paper
On Multiple Inheritance in Java
L. Bettini, M. Loreti, B. Venneri. Technology of Object-Oriented
Languages, Systems and Architectures, Proc. of TOOLS Eastern Europe
2002, (Theo D'Hondt, Ed.), pages 1-15, Kluwer Academic Publishers, 2003.
http://music.dsi.unifi.it/abstracts/multipinh-abs.html
http://music.dsi.unifi.it/papers/multipinh.ps.gz
we provide a general algorithm to automatically implement multiple
inheritance in Java; this also shows that it is not straighforward to
simulate the exact semantics of multiple inheritance through interfaces
and object composition.
Lorenzo
--
+-----------------------------------------------------+
| Lorenzo Bettini ICQ# lbetto, 16080134 |
| PhD in Computer Science |
| Dip. Sistemi e Informatica, Univ. di Firenze |
| Tel +39 055 4237441, Fax +39 055 4237437 |
| Florence - Italy (GNU/Linux User # 158233) |
| Home Page :
http://www.lorenzobettini.it |
|
http://music.dsi.unifi.it XKlaim language |
|
http://www.lorenzobettini.it/purple Cover Band |
|
http://www.gnu.org/software/src-highlite |
|
http://www.gnu.org/software/gengetopt |
|
http://www.lorenzobettini.it/software/gengen |
|
http://www.lorenzobettini.it/software/doublecpp |
+-----------------------------------------------------+