Xref: utzoo comp.lang.c++:3365 comp.lang.eiffel:196 comp.lang.smalltalk:1086 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!apple!ames!pasteur!ucbvax!ulysses!hector!jss From: jss@hector.UUCP (Jerry Schwarz) Newsgroups: comp.lang.c++,comp.lang.eiffel,comp.lang.smalltalk Subject: Re: Use of inheritance for classification? Message-ID: <11544@ulysses.homer.nj.att.com> Date: 18 May 89 18:07:49 GMT References: <30582@apple.Apple.COM> <6365@brunix.UUCP> <6685@brunix.UUCP> <24537@agate.BERKELEY.EDU> <6743@brunix.UUCP> Sender: netnews@ulysses.homer.nj.att.com Reply-To: jss@hector.UUCP (Jerry Schwarz) Organization: AT&T Bell Laboratories Lines: 29 These comments refer solely to my approach to using inheritance in C++ as I am not familiar enough with Eiffel or Smalltalk to make informed comments. When designing a class it is important to consider what I call the "protected interface". This is the interface between the class and classes derived from it. Part of this specification is what relationship there will be between the abstractions represented by the base class and those represented by the derived class. I know this goes against the "Object Oriented religion", but I believe that derivation should be done only from base classes that were designed with derivation in mind and then only in the way that was intended when the base class was specified. One possible relation between base and derived class is subsetting. That is derived classes should represent subsets or the set of objects represented by the base class. (This seems to be the intention of the "is-a" advocates.) Another relation (which I use frequently) is that derived classes should represent the same things as the base class but with differing implementations. This is particularly common when the base classes is "abstract", i.e. has "dummy" virtual member functions that must be supplied by derived classes. (In 2.0 there is syntax to allow this condition to be enforced by the compiler) Jerry Schwarz AT&T Bell Labs, Murray Hill