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 17:09:44 +0200
Date: 2008-06-02T17:09:44+02:00	[thread overview]
Message-ID: <pgttr29lj08x$.1xdqna9wei0na.dlg@40tude.net> (raw)
In-Reply-To: g20vec$1k1$1@aioe.org

On Mon, 02 Jun 2008 16:17:48 +0200, Dennis Hoppe wrote:

> Dmitry A. Kazakov wrote:
>> On Mon, 02 Jun 2008 15:39:05 +0200, Dennis Hoppe wrote:
>> 
>>> -- 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.
> 
> Hmm...this line is really a left over from simple inheritance without 
> generic unit, but the Ada compiler does not complain about it.

Then get another compile. The following:

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;

with Generic_Parent;
generic
   -- omitted
package Generic_Child is
   type Object is new Generic_Parent.Object with private;
   function Example return Integer;
end Generic_Child;

compiled by GNAT ends up with::

generic_child.ads:5:23: invalid prefix in selected component
"Generic_Parent"

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



  parent reply	other threads:[~2008-06-02 15:09 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
2008-06-02 14:17   ` Dennis Hoppe
2008-06-02 14:34     ` Georg Bauhaus
2008-06-02 15:09     ` Dmitry A. Kazakov [this message]
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