comp.lang.ada
 help / color / mirror / Atom feed
From: mbk@inls1.ucsd.edu (Matt Kennel)
Subject: Re: Initialization Params for Controlled Types
Date: 16 Nov 1994 21:45:00 GMT
Date: 1994-11-16T21:45:00+00:00	[thread overview]
Message-ID: <3adugs$j90@network.ucsd.edu> (raw)
In-Reply-To: 3a8k92$10rk@watnews1.watson.ibm.com

Norman H. Cohen (ncohen@watson.ibm.com) wrote:

: This is a more general problem that arises with OOP in any language: 
: Often the need arises to define a new class B that has MOST, BUT NOT ALL
: of the features of some other class A.  The problem is that the author of
: A, not having been omnisicient, failed to recognize it as a special case
: of a more general problem for which other special cases would arise in
: the future.  If you don't have the authority to modify the definition of
: class A, you end up duplicating a lot of code.  If you do have such
: authority, you can FACTOR the common features of A and B into a new class
: C, redefine A as a specialization of C, and define B as another
: specialization of C.

If you separate subtyping from implementation inheritance there
is no problem doing what you want.

In B, you inherit just some of the implementation of A.  This is not a problem
because by doing so you do not promise to uphold B as a subtype of A.

You then write an abstract class "C" that fits over A and B (with
no implementation) that abstracts the commonality.  A and B are
both subtypes of C, but neither is a subtype of each other.

: --
: Norman H. Cohen    ncohen@watson.ibm.com

--
-Matt Kennel  		mbk@inls1.ucsd.edu
-Institute for Nonlinear Science, University of California, San Diego
-*** AD: Archive for nonlinear dynamics papers & programs: FTP to
-***     lyapunov.ucsd.edu, username "anonymous".



  parent reply	other threads:[~1994-11-16 21:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-10-27  9:44 Initialization Params for Controlled Types Angel Alvarez
1994-10-27 14:27 ` Tucker Taft
1994-11-04 13:44   ` John English
1994-11-04 22:16     ` Norman H. Cohen
1994-11-05 15:01       ` Cyrille Comar
1994-11-07 10:32         ` John English
1994-11-07  9:08       ` John English
1994-11-10 15:23       ` John English
1994-11-11 10:44         ` Robb Nebbe
1994-11-14 21:19         ` Norman H. Cohen
1994-11-14 18:35           ` Robert I. Eachus
1994-11-16 21:45           ` Matt Kennel [this message]
1994-10-27 23:06 ` Robert Dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox