From: "John J. Rusnak" <john.rusnak@mindspring.com>
Subject: Re: friend classes in ada95
Date: 2000/04/14
Date: 2000-04-15T00:52:42+00:00 [thread overview]
Message-ID: <38F7BC00.F88AD37E@mindspring.com> (raw)
In-Reply-To: 38F6B617.34E216A7@emw.ericsson.se
Stefan Folkesson wrote:
> In ADA95, is there a way to make the private part of one class
> accessable from another (see friend classes in C++)?
>
> The reason I wonder this is because I want to apply the 'Iterator
> Pattern' in my design. This demands that the Iterator object can access
> the attributes of the Aggregate object.
>
> Is this possible? Is there a pragma to supress the access check or do I
> have to declare the attributes of the Aggregate class in the public part
> of the specification.
>
> /Stefan
Yes, and no pragma is needed.
In fact, a class has no control (that I am aware of) of who its "friends"
are. The way to implement a friend relationship is to use a child
package. A child package automatically has visibility into the private
parts of its parent's spec. The implementation of a friend class through a
child package does involve a tighter coupling of the class and its
"friend", but this is a good thing. One should only implement a friend
relationship if there is a strong need (and a need for strong coupling
between the classes).
-John
next prev parent reply other threads:[~2000-04-14 0:00 UTC|newest]
Thread overview: 91+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-04-14 0:00 friend classes in ada95 Stefan Folkesson
2000-04-14 0:00 ` swhalen
2000-04-14 0:00 ` Julian Day
2000-04-14 0:00 ` Steve Folly
2000-04-14 0:00 ` Robert A Duff
2000-04-17 0:00 ` John J. Rusnak
2000-04-18 0:00 ` Vincent Marciante
2000-04-18 0:00 ` John Rusnak
2000-04-18 0:00 ` Steve Folly
2000-04-14 0:00 ` Florian Weimer
2000-04-14 0:00 ` Stefan Folkesson
2000-04-14 0:00 ` John J. Rusnak [this message]
2000-04-15 0:00 ` Jeff Carter
2000-04-16 0:00 ` Robert Dewar
2000-04-16 0:00 ` Jeff Carter
2000-04-16 0:00 ` David Botton
2000-04-17 0:00 ` Robert Dewar
2000-04-17 0:00 ` Hyman Rosen
2000-04-17 0:00 ` Robert Dewar
2000-04-16 0:00 ` David Botton
2000-04-17 0:00 ` Robert Dewar
2000-04-17 0:00 ` David Botton
2000-04-18 0:00 ` friend classes in ada95 (long) tmoran
2000-04-18 0:00 ` David Botton
2000-04-18 0:00 ` friend classes in ada95 Stanley R. Allen
2000-04-19 0:00 ` friend classes in ada95 (long) Brian Rogoff
2000-04-19 0:00 ` David Botton
2000-04-19 0:00 ` Hyman Rosen
2000-04-19 0:00 ` Brian Rogoff
2000-04-23 0:00 ` Hyman Rosen
2000-04-23 0:00 ` Brian Rogoff
2000-04-24 0:00 ` Hyman Rosen
2000-04-25 0:00 ` Brian Rogoff
2000-04-25 0:00 ` Ole-Hjalmar Kristensen
2000-04-19 0:00 ` MI, was Re: friend classes in ada95 tmoran
2000-04-19 0:00 ` David Botton
2000-04-17 0:00 ` David Botton
2000-04-18 0:00 ` Geoff Bull
2000-04-18 0:00 ` Jean-Pierre Rosen
2000-04-18 0:00 ` tmoran
2000-04-18 0:00 ` John J. Rusnak
2000-04-19 0:00 ` Geoff Bull
2000-04-19 0:00 ` Jeff Susanj
2000-04-19 0:00 ` Bill Greene
2000-04-19 0:00 ` Robert Dewar
2000-04-19 0:00 ` Jeff Carter
2000-04-19 0:00 ` Ray Blaak
2000-04-20 0:00 ` Jean-Pierre Rosen
2000-04-20 0:00 ` Ray Blaak
2000-04-20 0:00 ` Jean-Pierre Rosen
2000-04-24 0:00 ` Ray Blaak
2000-04-20 0:00 ` Robert Dewar
2000-04-20 0:00 ` Brian Rogoff
2000-04-20 0:00 ` Jean-Pierre Rosen
2000-04-20 0:00 ` BSCrawford
2000-04-20 0:00 ` Robert Dewar
2000-04-20 0:00 ` Ray Blaak
2000-04-20 0:00 ` Charles Hixson
2000-04-21 0:00 ` Jon S Anthony
2000-04-21 0:00 ` Jean-Pierre Rosen
2000-04-29 0:00 ` Aidan Skinner
2000-04-29 0:00 ` Robert I. Eachus
2000-04-20 0:00 ` Robert Dewar
2000-04-20 0:00 ` Jeff Carter
2000-04-21 0:00 ` Robert Dewar
2000-04-21 0:00 ` Ken Garlington
2000-04-21 0:00 ` Jon S Anthony
2000-04-22 0:00 ` Robert Dewar
2000-04-19 0:00 ` tmoran
2000-04-19 0:00 ` Ehud Lamm
2000-04-19 0:00 ` David Botton
2000-04-19 0:00 ` Robert Dewar
2000-04-20 0:00 ` Geoff Bull
2000-04-19 0:00 ` Robert Dewar
2000-04-19 0:00 ` Robert Dewar
2000-04-19 0:00 ` Jean-Pierre Rosen
2000-04-19 0:00 ` Robert Dewar
2000-04-18 0:00 ` John Rusnak
2000-04-19 0:00 ` Robert Dewar
2000-04-18 0:00 ` Pascal Obry
2000-04-18 0:00 ` David Botton
2000-04-18 0:00 ` David Botton
2000-04-17 0:00 ` Robert I. Eachus
2000-04-18 0:00 ` Robert Dewar
2000-04-19 0:00 ` Robert I. Eachus
2000-04-20 0:00 ` Robert Dewar
2000-04-20 0:00 ` Ray Blaak
2000-04-23 0:00 ` Robert I. Eachus
2000-04-19 0:00 ` Alfred Hilscher
2000-04-19 0:00 ` Ray Blaak
2000-04-19 0:00 ` Robert Dewar
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox