comp.lang.ada
 help / color / mirror / Atom feed
From: John Robinson <john@jr-and-assoc.demon.co.uk>
Subject: Re: pointers & OOP
Date: 1999/05/06
Date: 1999-05-06T00:00:00+00:00	[thread overview]
Message-ID: <kIpDrKAHedM3EwRt@jr-and-assoc.demon.co.uk> (raw)
In-Reply-To: 3731d200.1993345@news.pacbell.net

In article <3731d200.1993345@news.pacbell.net>, Tom Moran
<tmoran@bix.com> 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




  reply	other threads:[~1999-05-06  0:00 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-05-01  0:00 pointers & OOP Matthew Heaney
1999-05-01  0:00 ` Matthew Heaney
1999-05-03  0:00 ` John Robinson
1999-05-03  0:00   ` Samuel Mize
1999-05-04  0:00     ` Robert Dewar
1999-05-04  0:00     ` Martin C. Carlisle
1999-05-04  0:00   ` Robert Dewar
1999-05-04  0:00     ` Mike Silva
1999-05-05  0:00     ` John Robinson
1999-05-05  0:00       ` Matthew Heaney
1999-05-05  0:00       ` Robert Dewar
1999-05-05  0:00         ` John Robinson
1999-05-06  0:00           ` Brian Rogoff
1999-05-07  0:00             ` dennison
1999-05-07  0:00               ` Brian Rogoff
1999-05-10  0:00                 ` dennison
1999-05-11  0:00                   ` Jean-Pierre Rosen
1999-05-11  0:00                     ` dennison
1999-05-10  0:00             ` John Robinson
1999-05-14  0:00               ` Matthew Heaney
1999-05-14  0:00                 ` David Botton
1999-05-14  0:00           ` Matthew Heaney
1999-05-14  0:00             ` Ed Falis
1999-05-05  0:00       ` Robert Dewar
1999-05-08  0:00         ` Ehud Lamm
1999-05-06  0:00       ` Simon Wright
1999-05-06  0:00         ` John Robinson
1999-05-08  0:00           ` Simon Wright
1999-05-10  0:00             ` John Robinson
1999-05-06  0:00       ` Tom Moran
1999-05-06  0:00         ` John Robinson [this message]
1999-05-06  0:00           ` Tom Moran
1999-05-07  0:00             ` dennison
1999-05-07  0:00             ` dennison
1999-05-07  0:00             ` dennison
1999-05-10  0:00             ` John Robinson
1999-05-14  0:00         ` Matthew Heaney
1999-05-05  0:00     ` Francois Godme
  -- strict thread matches above, loose matches on Subject: below --
1999-05-01  0:00 Tom Moran
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox