Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!tut.cis.ohio-state.edu!ucbvax!pasteur!icsib6!ahmad From: ahmad@icsib6.berkeley.edu (Subutai Ahmad) Newsgroups: comp.object Subject: Re: Subclassing vs. subtyping Message-ID: <18125@pasteur.Berkeley.EDU> Date: 9 Oct 89 19:19:50 GMT References: <33009@cornell.UUCP> <1989Oct9.184205.20790@polyslo.CalPoly.EDU> Sender: news@pasteur.Berkeley.EDU Reply-To: ahmad@icsib6 (Subutai Ahmad) Distribution: usa Organization: International Computer Science Institute, Berkeley Lines: 21 In article <1989Oct9.184205.20790@polyslo.CalPoly.EDU> ttwang@polyslo.CalPoly.EDU (Thomas Wang) writes: >.... There are two kinds of inheritance. >The first kind is real ISA relationship, such as student-person. You can say >with confidence that a student is a person. The second kind is what I call >marriage of convenience, such as your example of venetian blind - rectangle. >Venetian blind is a shade, but is it a rectangle? It is not so clear that >a venetian blind ISA a rectangle. > >In this situation, the best thing to do is to allow venetian blind to >steal some functionalities from rectangle, but say that a venetian blind >is not ISA a rectangle. What if you also had a class called "shade"? This is exactly the type of situation (no pun intended) where you need multiple inheritance. Just inherit the properties you want from shade AND rectangle. Another way of looking at it is that the ISA relationship doesn't have to be an exclusive property. A Venetial blind ISA rectangle but it also ISA shade. --Subutai Ahmad