comp.lang.ada
 help / color / mirror / Atom feed
* Ada: Inheritance of generics
@ 2008-06-02 13:39 Dennis Hoppe
  2008-06-02 13:51 ` Dmitry A. Kazakov
  2008-06-02 14:30 ` Georg Bauhaus
  0 siblings, 2 replies; 8+ messages in thread
From: Dennis Hoppe @ 2008-06-02 13:39 UTC (permalink / raw)


Hi,

I managed to implement a generic parent class and create a generic unit, 
which is a child of the first one. I wonder, why I have access to 
procedures and functions of the parent class, if I am "within" the child 
unit, but if I am "outside", the compiler complains that no selector for 
a specified function exists.

-- generic parent
generic
   type Modular_Type is mod <>;
package Generic_Parent is
   type Object is abstract tagged limited null record;

   function Example return Integer;
end Generic_Parent;


-- child unit
generic
   -- omitted
package Generic_Child is
   type Object is new Generic_Parent.Object with private;

   function Example return Integer;
end Generic_Child;


-- testsuite
package Parent is new Generic_Parent (2**16);
package Child is new Parent.Object;

-- compiler error, no selector for ...
A : Integer := Child.Example;


My aim is to append some generic childs to a container and iterate
over each item and call a common procedure or function.


Best regards,
   Dennis Hoppe



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

end of thread, other threads:[~2008-06-02 21:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-02 13:39 Ada: Inheritance of generics Dennis Hoppe
2008-06-02 13:51 ` Dmitry A. Kazakov
2008-06-02 14:17   ` Dennis Hoppe
2008-06-02 14:34     ` Georg Bauhaus
2008-06-02 15:09     ` Dmitry A. Kazakov
2008-06-02 15:13     ` Adam Beneschan
2008-06-02 21:10       ` Dennis Hoppe
2008-06-02 14:30 ` Georg Bauhaus

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