comp.lang.ada
 help / color / mirror / Atom feed
From: slos <new.stephane.los@gmail.com>
Subject: Re: Polymorphism
Date: Thu, 14 May 2015 14:34:07 -0700 (PDT)
Date: 2015-05-14T14:34:07-07:00	[thread overview]
Message-ID: <835a2cf7-0e27-4759-af80-8c93dc4f5a62@googlegroups.com> (raw)
In-Reply-To: <mirl2d$mij$1@loke.gir.dk>

Le mardi 12 mai 2015 03:29:50 UTC+2, Randy Brukardt a écrit :
> "slos" wrote in message 
> news:...
> Le jeudi 7 mai 2015 21:09:33 UTC+2, Randy Brukardt a écrit :
> ...
> > If I remember correctly, I should have verified before posting but it's 
> > already
> > late, in C++ one can have protected members which can be used by friends.
> > I can't see in Ada such thing like protected stuff and friends. Maybe 
> > there is ?
> 
> Ada uses child packages for that sort of functionality; to be a "friend" in 
> Ada, a package has to be a child. Often, a parent and set of children is 
> referred to as a "subsystem". [Private packages also can be part of a 
> subsystem, that's where they're useful.] Unrestricted use of friends 
> appeared to lead to madness (at a minimum, visibility madness), where 
> dependencies go all which ways. Ada limits such dependencies to a single 
> subsystem. (Generally, one wants to minimize dependences.)
> 
> ...
> >I am quite happy with the child package solution exposed here by Simon
> >but then that has disturbed my packages hierarchy... ;-)
> 
> Yup. There's no free lunch. ;-)
> 
>                      Randy.

Hello Randy,

Thanks for your detailed information.
In fact, I am very happy with the solution and it ends up quite understandable, from my point of view...

Since derived objects are children of their parent class, it seems logical that the packages where they are defined are also children of those where their parent is.

That's only necessary if needed to access private attributes and methods but it is maybe a good idea to do so in most cases since the package hierarchy then mimics the objects hierarchy, isn't it ?

Best Regards,
Stéphane
http://slo-ist.fr/ada4autom

  reply	other threads:[~2015-05-14 21:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-06 23:05 Polymorphism slos
2015-05-07  7:28 ` Polymorphism Simon Wright
2015-05-07  8:32   ` Polymorphism slos
2015-05-07  7:41 ` Polymorphism Dmitry A. Kazakov
2015-05-07  8:34   ` Polymorphism slos
2015-05-07 19:09   ` Polymorphism Randy Brukardt
2015-05-11 22:05     ` Polymorphism slos
2015-05-12  1:29       ` Polymorphism Randy Brukardt
2015-05-14 21:34         ` slos [this message]
  -- strict thread matches above, loose matches on Subject: below --
1996-11-25  0:00 polymorphism W. Wesley Groleau (Wes)
replies disabled

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