comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Indirect visibility of private part in child packages
Date: Thu, 04 Jun 2009 09:22:05 -0400
Date: 2009-06-04T09:22:05-04:00	[thread overview]
Message-ID: <wcc1vq02kxu.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: bc225421-978e-41f8-8a01-d370e5236673@h11g2000yqb.googlegroups.com

"Hibou57 (Yannick Duch�ne)" <yannick_duchene@yahoo.fr> writes:

> On 4 juin, 09:50, Ludovic Brenta <ludo...@ludovic-brenta.org> wrote:
>> Maybe you can solve your problem like this:
>>
>> package body P1.P3 is
>> � �procedure A_Primitive (Item : out T3_Type) is
>> � �begin
>> � � � T1_Type (Item).Low_Level_Data := ...;
>> � �end A_Primitive;
>> end P1.P3;
>
> I've just tried it, and it does not work better. The compiler
> complains there are not selector Low_Level_Data for T1_Type.

Are you sure?  Converting to T1_Type should work.  P3 can see that
T1_Type has a Low_Level_Data component.

The reason your original example didn't work is that the components of
T2_Type are "nailed down" at the point where it's declared,
and P3 can't see that.  It can, however, see that it's derived
from T1_Type, so converting should work.

>> � �procedure Set (Item : out T1_Type; Data : in Some_Type);
>> end P1;
>>
>> package body P1.P3 is
>> � �procedure A_Primitive (Item : out T3_Type) is
>> � �begin
>> � � � Set (Item, Data => ...); -- OK, calls inherited primitive
>> operation
>> � �end A_Primitive;
>> end P1.P3;
>>
>> HTH
>
> I will try it soon and tell about the result. But at first sight, I
> think that the compiler gonna complain that Set is a primitive of
> T1_Type and thus that it must be defined in the public part. Further
> more, I think Set would habe to be redefined for each T2_Type, T3_Type
> and etc.

You could make Set class-wide.

- Bob



  reply	other threads:[~2009-06-04 13:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-04  5:45 Indirect visibility of private part in child packages Hibou57 (Yannick Duchêne)
2009-06-04  7:50 ` Ludovic Brenta
2009-06-04 11:47   ` Hibou57 (Yannick Duchêne)
2009-06-04 13:22     ` Robert A Duff [this message]
2009-06-04 14:04       ` Hibou57 (Yannick Duchêne)
2009-06-04 16:06 ` Adam Beneschan
2009-06-04 16:33   ` Hibou57 (Yannick Duchêne)
replies disabled

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