Date: Thu, 18 Sep 2003 09:54:38 -0400
From: Aleksandar Donev <[log in to unmask]>
Problems start appearing when, for
example: A extends B which extends C, and A extends D which also extends C.
Does A have two distinct subobjects of type C (we call them grandparent
components in F2003, I guess), or one?
To help make your point: In CommonLisp there is one. (As stated) In
C++ there would be two. But in C++ any classes that are inherited
"virtual" are kept as a single component instance, so if *BOTH* (or
*ALL*) are inherited virtually, there would be just one.
Multiple inheritance is a big complication to a language with many
such "arbitrary" decisions.
Java went the single-inheritance route. It is certainly the easier
one, easier to implement, easier to optimize, and easier to think
about and maintain. CommonLisp has some rigid rules for how multiple
inheritance works, and they are designed to ease the conceptual
burden. (I'm probably biased, but I wouldn't call the decisions
"arbitrary" as they were deliberate and thought out.) C++ also has
rigid rules, but the possibility of virtual and non-virtual
inheritance really messes up the conceptual model.
It is useful and sometimes maybe necessary, but complicated. ...
I have used multiple inheritance in C++ to great advantage. In a few
select places. I've often wondered how I would recode those classes
in a single-inheritance model...
|