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=0.1 required=5.0 tests=BAYES_05,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5394d9ca5f955366 X-Google-Attributes: gid103376,public From: Matthew Heaney Subject: Re: pointers & OOP Date: 1999/05/14 Message-ID: #1/1 X-Deja-AN: 477859790 References: <$DL10CAsSgL3Iwj3@jr-and-assoc.demon.co.uk> <7gn7gr$fr5$1@nnrp1.dejanews.com> <3731d200.1993345@news.pacbell.net> NNTP-Posting-Date: Fri, 14 May 1999 09:31:46 PDT Newsgroups: comp.lang.ada Date: 1999-05-14T00:00:00+00:00 List-Id: tmoran@bix.com (Tom Moran) writes: > Suppose you have > type Root is abstract tagged ... > procedure Very_General(X : in out Root); > private > procedure Internal_Updating(X : in out Root'class); > and then Root has a son and a daughter > type Son is new Root with ... > and > type Daughter is new Root with ... > and suppose that Son and Daughter need to use Root's Internal_Updating > procedure. If they are both declared in the same package as Root, no > problem. Even if they are declared in child packages of Root, no > problem. But if they are declared in truly separate packages, then > either they cannot see Internal_Updating, or else you move > Internal_Updating to the public part of Root's package, thus letting > anybody see and call Internal_Updating. > How would you propose structuring this if you are required to have > 1-1 package/class? Son and Daughter go in (public) child packages. A child has visibility to the private part of its parent. package Family is type Root is .. private procedure Internal_Update ...; end; package Family.Sons is type Son is new Root with ...; ... end Family.Sons; package Family.Daughters is type Daughter is new Root with ...; end Family.Daughters;