comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Ada: Inheritance of generics
Date: Mon, 2 Jun 2008 15:51:05 +0200
Date: 2008-06-02T15:51:06+02:00	[thread overview]
Message-ID: <1d2swajw7rsue$.ftt2098a7wvt$.dlg@40tude.net> (raw)
In-Reply-To: g20t5p$ptn$1@aioe.org

On Mon, 02 Jun 2008 15:39:05 +0200, Dennis Hoppe wrote:

> 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;

This is illegal. Generic_Parent is a generic unit, you cannot refer to
anything within it without either instantiation of, or else from a generic
child unit of. Generic_Child is not a child package of Generic_Parent.

P.S. Except for trivial cases, it is always better to post complete code
samples.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



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

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