comp.lang.ada
 help / color / mirror / Atom feed
From: comar@cs.nyu.edu (Cyrille Comar)
Subject: Re: Type extension questions
Date: 25 Mar 1995 02:13:49 -0500
Date: 1995-03-25T02:13:49-05:00	[thread overview]
Message-ID: <3l0frd$b9t@lang8.cs.nyu.edu> (raw)
In-Reply-To: D5wyp1.Fsv@ennews.eas.asu.edu

koehnema@enuxsa.eas.asu.edu (Harry Koehnemann) writes:
: I don't think my request was clear enough.  This is close, but I'd
: like P.T to be extensible.  The above approach hides the fact that P.T
: is tagged and therefore extensions of P.T are not allowed.  What I
: really want is private inheritance ala C++.
: 
: Thanks for the reply.  Any other suggestions?

(sorry for previous empty message, I try again)

Don't try to be too close to C++, this doesn't fit Ada's
model. "Private inheritance" is meaningless in Ada since "Private" is
a caracteristic of packages and inheritance a characteristic of types
but you can still do something very close from what you want :
package P is
   type T is tagged private;
   procedure Visible_Method (X : T);
private 
   procedure Private_Method (X : T);
   type T is ...
end P;

with P; use P;
package Q is 
  type T2 is new T with ....;
end Q;

a client of Q can use the inherited Visible_Method but not
Private_Method (unless the client happen to be child of P but this is
an other story... ;-)
-- 
------------------------------------------------------------------------
Cyrille Comar,                                  E-mail: comar@cs.nyu.edu
Gnat Project                                    US phone: (212) 998-3489




  parent reply	other threads:[~1995-03-25  7:13 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 [this message]
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
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