comp.lang.ada
 help / color / mirror / Atom feed
From: mbk@jt3ws1.etd.ornl.gov (Kennel)
Subject: Re: Type extension questions
Date: 27 Mar 1995 20:37:52 GMT
Date: 1995-03-27T20:37:52+00:00	[thread overview]
Message-ID: <3l77n0$hdb@stc06.ctd.ornl.gov> (raw)
In-Reply-To: D640KK.63D@ennews.eas.asu.edu

Harry Koehnemann (koehnema@enuxsa.eas.asu.edu) wrote:
> Well, yes and no.  What I really want to do is restrict the interface
> to a type.  It might help to see an example.  Let's pretend we have 2
> abstract data types, where one is an extension of the other:

>     class List {
> 	public:  Set (...) { ...}
> 	private: ...;
>     };

>     class Stack : private List {
> 	public:  Push() { ...}
> 	private: ...;
>     };

> It is not appropriate for a Stack to invoke Set.  One could argue that
> Stack has-a List instead of Stack is-a list (I think Tucker Taft made
> this argument earlier).  Bottom line - I guess there is no way to
> perform private inheritance, as shown in the above example, in Ada95,
> which was my question.  Thanks for the input.

I wouldn't call this 'has-a' *or* 'is-a'.

I would call it 'is-implemented-as-a'.

For example, we may want many features from List to be *public*, and
yet still *not* allow a Stack to be substituted at run-time for a List.
{i.e. divorce subtyping from inheritance, a convenient idea i've found}

How ought one do this in Ada?

cheers
matt




  parent reply	other threads:[~1995-03-27 20:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-03-22  0:25 Type extension questions Harry Koehnemann
1995-03-22 12:01 ` Robb Nebbe
1995-03-23 22:05   ` Harry Koehnemann
1995-03-25  6:59     ` Cyrille Comar
1995-03-25  7:13     ` Cyrille Comar
1995-03-27  0:00       ` Norman H. Cohen
1995-03-30  0:00         ` Cyrille Comar
1995-03-27 17:29       ` Harry Koehnemann
1995-03-27 20:26         ` Robert I. Eachus
1995-03-29  0:00           ` Harry Koehnemann
1995-03-27 20:37         ` Kennel [this message]
1995-03-23 22:03 ` Tucker Taft
replies disabled

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