genly@bubble.multiflow.COM (Chris Hind Genly) (02/07/90)
How do polymorphism and multiple inheritance interact? If a class, C,
inherits from two others, A and B, can a reference of type C be
assigned to one of type A or B?
I can't see any problem offhand. I would think such an assignment
would be prohibited with repeated inheritance.
class A
...
end;
class B
...
end;
class C
inherit A; B
...
end;
class main
feature
c:C;
b:B;
a:A;
...
a := c; <--- Is this legal?
b := c; <--- Is this legal?
end;
OOSC indicates a polymorphic assignment is legal if the type being
assigned conforms to the type being assigned to. This rule is defined
in the book before multiple inheritance is introduced. I couldn't
find a better definition for conformance involving multiple
inheritance. Do you know?
(Our disk where news is stored had some problems recently. So you may
have seen this message before. But I was unable to receive any
responses.)
--
=======================================================================
Chris Hind Genly, N1GLZ - Multiflow Computer - mfci!genly (203)488-6090