[comp.lang.eiffel] Implementing Multiple Inheritance

budd@mist.cs.orst.edu (Tim Budd) (03/09/89)

I don't have access to a version of C++ that supports multiple inheritence,
nor do I have eiffle, so I can't answer these questions empirically.  So
when all else fails, ask the net!

I understand how message passing in C++ or eiffle can be made almost as
efficient as procedure calls (in fact procedure calls with one level of
indirection).  But it would appear to me that multiple inheritence messes
things up rather badly.  Here is an example.

Suppose I have a class A that implements methods for a, b and c.
	I can make a method table for A consisting of three pointers to
	functions.
class B is a subclass of A that reimplments b and adds d.
	I can make a method table for B consisting of four pointers to
	functions, two of which are the same as for A..
Suppose now I have a variable x that is declared to be of type A.
It can actually hold variables of either type A or B, and a call can be
made on b, for example, by (x.methodTable[1])(...), getting the appropriate
version of b() depending on the class.  (the lookup is internal, of course,
so the syntax here is made up. used zero based indexing ).

Now I have another class P implementing p,q,r and a subclass Q reimplments
q and adds s.  A variable y is declared to be of type P.
To get at method q, for example, we execute (y.methodTable[1])(...).

Now, suppose I make a class W that is a subclass of both B and Q.
Can an instance of W be assigned to x?  Can it be assigned to y?
How can be make a method table that efficiently allows us to get to both 
b and q ?  I don't see how to do this without drastic performance
penalties.

In addition to an explanation, a pointer to any published literature would
be appreciated.
thanks.