comp.lang.ada
 help / color / mirror / Atom feed
* Question about generic child packages
@ 2016-10-13 17:01 Charly
  2016-10-13 17:19 ` Dmitry A. Kazakov
  0 siblings, 1 reply; 3+ messages in thread
From: Charly @ 2016-10-13 17:01 UTC (permalink / 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-10-14  8:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-13 17:01 Question about generic child packages Charly
2016-10-13 17:19 ` Dmitry A. Kazakov
2016-10-14  8:55   ` Charly

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