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,5394d9ca5f955366 X-Google-Attributes: gid103376,public From: John Robinson Subject: Re: pointers & OOP Date: 1999/05/06 Message-ID: #1/1 X-Deja-AN: 474825953 X-NNTP-Posting-Host: jr-and-assoc.demon.co.uk:194.222.150.244 References: <$DL10CAsSgL3Iwj3@jr-and-assoc.demon.co.uk> <7gn7gr$fr5$1@nnrp1.dejanews.com> <3731d200.1993345@news.pacbell.net> X-Trace: news.demon.co.uk 926013608 nnrp-06:25044 NO-IDENT jr-and-assoc.demon.co.uk:194.222.150.244 MIME-Version: 1.0 Newsgroups: comp.lang.ada X-Complaints-To: abuse@demon.net Date: 1999-05-06T00:00:00+00:00 List-Id: In article <3731d200.1993345@news.pacbell.net>, 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? > Use parent-child structuring. Internal_Updating is a protected operation. I would still consider this to be a one to one mapping, although I don't use parent-child packages unless I have to. I would also mark the class diagram (probably with a stereotype) to provide a visual clue that the parent-child relationship exists. If there is a significant amount of behavioural coupling between the classes they probably ought to be combined anyway (maybe you have split one role across two classes?). -- John Robinson John Robinson & Associates www.jr-and-assoc.demon.co.uk