comp.lang.ada
 help / color / mirror / Atom feed
From: Dennis Hoppe <dennis.hoppe@hoppinet.de>
Subject: Ada: Inheritance of generics
Date: Mon, 02 Jun 2008 15:39:05 +0200
Date: 2008-06-02T15:39:05+02:00	[thread overview]
Message-ID: <g20t5p$ptn$1@aioe.org> (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



             reply	other threads:[~2008-06-02 13:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-02 13:39 Dennis Hoppe [this message]
2008-06-02 13:51 ` Ada: Inheritance of generics 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
replies disabled

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