Talk About Network

Google





Programming > Ada > Ada: Inheritanc...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 8 Topic 5735 of 6006
Post > Topic >>

Ada: Inheritance of generics

by Dennis Hoppe <dennis.hoppe@[EMAIL PROTECTED] > Jun 2, 2008 at 03:39 PM

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
 




 8 Posts in Topic:
Ada: Inheritance of generics
Dennis Hoppe <dennis.h  2008-06-02 15:39:05 
Re: Ada: Inheritance of generics
"Dmitry A. Kazakov&q  2008-06-02 15:51:05 
Re: Ada: Inheritance of generics
Dennis Hoppe <dennis.h  2008-06-02 16:17:48 
Re: Ada: Inheritance of generics
Georg Bauhaus <rm.dash  2008-06-02 16:34:47 
Re: Ada: Inheritance of generics
"Dmitry A. Kazakov&q  2008-06-02 17:09:44 
Re: Ada: Inheritance of generics
Adam Beneschan <adam@[  2008-06-02 08:13:09 
Re: Ada: Inheritance of generics
Dennis Hoppe <dennis.h  2008-06-02 23:10:03 
Re: Ada: Inheritance of generics
Georg Bauhaus <rm.dash  2008-06-02 16:30:29 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Wed Jan 7 13:27:14 PST 2009.