Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!usc!polyslo!ttwang From: ttwang@polyslo.CalPoly.EDU (Thomas Wang) Newsgroups: comp.object Subject: Re: Subclassing vs. subtyping Message-ID: <1989Oct9.184205.20790@polyslo.CalPoly.EDU> Date: 9 Oct 89 18:42:05 GMT References: <33009@cornell.UUCP> Reply-To: ttwang@polyslo.CalPoly.EDU (Thomas Wang) Distribution: usa Organization: Cal Poly State University -- San Luis Obispo Lines: 44 wilk@cs.cornell.edu (Michael Wilk) writes: >A "class" serves at least two purposes: the (usually run-time) >generation of "instances" and the (usually compile-time) genera- >tion of "subclasses." If we think of classes as sets, then >instances of that class refer to members of that set. >The meaning of a subclass is more subtle. In Smalltalk and CLOS >(and probably others) a subclass represents a set of objects that >are extensions of objects in the original class: they have the >same instance variables and methods, and additional instance >variables and methods can be added. >This seems to me a programming construct that has no semantic >correlation to anything outside of programming. Let us consider >an example below. A rectangle is what you think it is; a >venetian blind is a rectangular geometric figure with additional >horizontal lines. This is a very interesting point. 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. I remembered someone on the net call them 'real inheritance', and 'user inheritance'. I don't know if they are common terminalogies. This is yet another example of an OO concept with multiple names. We need standard terminalogies fast! >Michael Wilk (wilk@cs.cornell.edu) -Thomas Wang (There is a maniac in the bathtub!! -Akane in "Ranma 1/2") ttwang@polyslo.calpoly.edu