From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,68c80d9ad156e257 X-Google-Attributes: gid103376,public From: comar@lang8.cs.nyu.edu (Cyrille Comar) Subject: Re: Type extension questions Date: 1995/03/30 Message-ID: <3lf8rm$8he@lang8.cs.nyu.edu>#1/1 X-Deja-AN: 100540675 distribution: world references: <3l6q0i$12kj@watnews1.watson.ibm.com> organization: New York University newsgroups: comp.lang.ada Date: 1995-03-30T00:00:00+00:00 List-Id: 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