Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!uwm.edu!uakari.primate.wisc.edu!ginosko!brutus.cs.uiuc.edu!usc!bloom-beacon!eru!luth!sunic!tut!tukki!sakkinen
From: sakkinen@tukki.jyu.fi (Markku Sakkinen)
Newsgroups: comp.lang.c++
Subject: Re: OO terminology (Was: OO Design books)
Keywords: OOP, books
Message-ID: <1398@tukki.jyu.fi>
Date: 28 Sep 89 08:44:15 GMT
References: <583@calmasd.Prime.COM> <4557@orca.WV.TEK.COM> <1333@tukki.jyu.fi> <1989Sep21.185448.13515@oresoft.uu.net>
Reply-To: markku@jytko.jyu.fi (Markku Sakkinen)
          SAKKINEN@FINJYU.bitnet (alternative)
Organization: University of Jyvaskyla, Finland
Lines: 50

In article <1989Sep21.185448.13515@oresoft.uu.net> dan@oresoft.uu.net (Daniel Elbaum) writes:
>In article <1333@tukki.jyu.fi> markku@jytko.jyu.fi (Markku Sakkinen) SAKKINEN@FINJYU.bitnet (alternative) writes:
>:In article <4557@orca.WV.TEK.COM> brucec@demiurge.WV.TEK.COM (Bruce Cohen) writes:
>:> [...]
>:>(I'd much rather say "superclass", than "immediately ancestral base class")
>:> ...
>
>:I would also prefer 'subclass' to 'derived class': if a class X consists
>:of an array of class Y objects, say, equipped with some member functions,
>:then one could also like to say that X is "derived" from Y.
>
>'super-' and 'sub-' class terminology can introduce confusion.
>If X is a a base class of Y, then a Y is an X but not vice-versa,
>and so X is the more general of the two.  On the other hand,
>Y is a superset of X; every Y has an X in it, so you could say
>that X is a subclass of Y.

Inheritance in most OOPL's does not guarantee an "is-a" relationship:
it is therefore that 'super-' and 'sub-' class terminology may indeed
cause confusion (supertype - subtype). This matter has been discussed
a lot recently, mainly in comp.lang.eiffel, I think.

Current C++ seems to take the position that if any public member of a
base class is made protected or private in a derived class, then the
derived class is not regarded as a subclass. This means that a derived
class object cannot be used where a base class object it expected.
I think this view is very sensible.

In Daniel's last statement above, there seems to be a confusion between
the "is-part-of" and "is-a" relationships. This confusion is difficult
to avoid: e.g. the Wiener and Pinson book falls into the trap
in the very first example it tries to give about inheritance.

>The 'base' and 'derived' terms are unambiguous and adequate.  I
>find geneological terminology more useful, under which X is the
>'parent' of Y and any base class of X is a 'grandparent'.  After
>all, kinship structure is the basis for our notion of hierarchy
>and inheritance.

The terms 'parent' and 'child' are used in some of the literature,
and might me the preferable ones. They don't imply the additional
meaning that 'superclass' and 'subclass' may do. The terms 'base'
and 'derived' are peculiar to the C++ terminology, as far as I know.

Markku Sakkinen
Department of Computer Science
University of Jyvaskyla (a's with umlauts)
Seminaarinkatu 15
SF-40100 Jyvaskyla (umlauts again)
Finland