comp.lang.ada
 help / color / mirror / Atom feed
From: comar@lang8.cs.nyu.edu (Cyrille Comar)
Subject: Re: Type extension questions
Date: 1995/03/30
Date: 1995-03-30T00:00:00+00:00	[thread overview]
Message-ID: <3lf8rm$8he@lang8.cs.nyu.edu> (raw)
In-Reply-To: 3l6q0i$12kj@watnews1.watson.ibm.com

ncohen@watson.ibm.com (Norman H. Cohen) writes:
: In article <3l0frd$b9t@lang8.cs.nyu.edu>, comar@cs.nyu.edu (Cyrille Comar)
: writes: 
: |> koehnema@enuxsa.eas.asu.edu (Harry Koehnemann) writes: 
: ...
: |> :                                                             What I
: |> : really want is private inheritance ala C++.
: |>
: |> 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
: 
: No, there is a direct Ada analog to a C++ class with a private base
: class, namely a private type implemented as a tagged derived type: 
: 
:    package Base_Type_Package is
:       type Base_Type is tagged ...;
:       ...
:    end Base_Type_Package;
: 
:    with Base_Type_Package;
:    package Derived_Type_Package is
:       type Derived_Type is private;
:       procedure Some_Operation (X: in out Derived_Type);
:       ...
:    private
:       type Derived_Type is new Base_Type_Package.Base_Type with ...;
:    end Derived_Type_Package;
: 
: --
: Norman H. Cohen    ncohen@watson.ibm.com



No, This is NOT a direct analog! A private Child package of
Derived_Type_Package has full visibility over Drived_Type and
Base_Type and you CANNOT enforce private inheritance in this
context. Your statement is correct if and only if you are ready to
accept a non-sense rule such as 1 package = 1 class = 1 tagged type or
something like that.

I really think it is important to avoid the confusion between packages
which controls the privacy in Ada and C++ classes which also control
the provacy but are more related to tagged type than to packages...
-- 
------------------------------------------------------------------------
Cyrille Comar,                                  E-mail: comar@cs.nyu.edu
Gnat Project                                    US phone: (212) 998-3489





  reply	other threads:[~1995-03-30  0:00 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 [this message]
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