Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!howland.reston.ans.net!cs.utexas.edu!newsfeed.rice.edu!hsdndev!ncar!uchinews!news
From: kit@delphi.bsd.uchicago.edu (Kit Transue)
Subject: Re: [Q] Multiple Inheritance
Message-ID: <1995Jan30.152213.10890@midway.uchicago.edu>
Sender: news@uchinews.uchicago.edu (News System)
Organization: University of Chicago -- Academic Information Technologies
References: <JKVG.95Jan29195005@kamet.ccs.neu.edu>
Date: Mon, 30 Jan 1995 15:22:13 GMT
Lines: 50

In article <JKVG.95Jan29195005@kamet.ccs.neu.edu> jkvg@kamet.ccs.neu.edu  
(Jagadeesh Krishnamurthy Venugopal) writes:
> 
> I have heard people that program in other OO languages (read C++  
programmers)
> as saying that one of the major drawbacks of smalltalk as being the fact  
that
> it does not support multiple inheritance.
> 
> Since I am but a beginning student in OO theory, I'd be extremely  
grateful if
> someone could tell me why multiple inheritance is needed, how if at all  
it's
> absence in Smalltalk might be a disadvantage for the programmer, and any
> techniques that might be used to either simulate multiple inheritance or  
work
> around it's absence.
> 
> Thanks a lot in advance,
> 
> Jagadeesh
> 



Whether MI is _needed_ or not depends on the relationship between  
inheritance and type.  In C++, the type compatiblity follows public  
inheritance.  This implies that if you have an object that has two  
distinct "is-a" relationships, you need MI to bring them together.  In  
Smalltalk, the type system is unrelated to the inheritance hierarchy.   
Instead, all an object needs to do to be compatible with a type is to  
implement the methods that that type requires.  This makes it possible for  
an object that's unrelated by inheritance to be of a certain type.

In other words, it's fairly easy to implement a class that can be used in  
place of a variety of classes in Smalltalk--simply implement the methods  
required by both "base" classes.  One way of doing this is to embed an  
object inside the multi-type object, and forward messages to this "base  
component".  [I'm using quotes here to indicate that while the  
functionality provided is like public derivation in C++, the "base"  
classes are not related through derivation.]

Having MI is very important to analysis.  Design is easier if the language  
constructs map closely to the constructs used in analysis.

Consult a modern C++ book for issues concerning diamond-shaped inheritance  
graphs.

hope this is of help.
kit transue
