🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.eiffel
Article #1534

Polymorphism and Multiple Inheritance

#1534
From: Chris Hind Genly
Date: Tue, 06 Feb 1990 21:34
49 lines
1516 bytes
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

	
Technical Details
Message-ID: <1222@m3.mfci.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!yale!mfci!m3!genly

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!yale!mfci!m3!genly
From: genly@bubble.multiflow.COM (Chris Hind Genly)
Newsgroups: comp.lang.eiffel
Subject: Polymorphism and Multiple Inheritance
Message-ID: <1222@m3.mfci.UUCP>
Date: 6 Feb 90 21:34:52 GMT
Sender: news@mfci.UUCP
Distribution: comp
Organization: Multiflow Computer Inc., Branford, CT
Lines: 49