comp.lang.ada
 help / color / mirror / Atom feed
From: Charly <carl.weierstrass@googlemail.com>
Subject: Question about generic child packages
Date: Thu, 13 Oct 2016 10:01:10 -0700 (PDT)
Date: 2016-10-13T10:01:10-07:00	[thread overview]
Message-ID: <08d81628-f1a6-430b-b023-0166a1bedfaa@googlegroups.com> (raw)

Hi,

I have the following question:
Is it possible to have a generic parent package Parent with two (or more)
child packages and than use objects defined in one of the children and use
it in the other one?
Following is a very simple example to show my problem.
In Child_A I defined a function Double and want to use it in Child_B.
It would also be nice to use objects in Child_A, that are defined in B,
not shown in following example.
Of course I can make Child_B a subchild of Child_A, but that is
unsatisfying because it is asymmetric and does not solve the second
part with mutual usage.


--------------------
generic
    type Data is digits <>;
package Parent is

end Parent;

--------------------
generic
package Parent.Child_A is

   function Double
     (X : in Data)
      return Data
   is
     (2.0 * X);

end Parent.Child_A;

--------------------
with Parent.Child_A;

generic
package Parent.Child_B is

   function Test
     (X : in Data)
      return Data
   is
      (2.0 * Parent.Child_A.Double (X));


end Parent.Child_B;


Charly


             reply	other threads:[~2016-10-13 17:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-13 17:01 Charly [this message]
2016-10-13 17:19 ` Question about generic child packages Dmitry A. Kazakov
2016-10-14  8:55   ` Charly
replies disabled

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