comp.lang.ada
 help / color / mirror / Atom feed
From: Ludovic Brenta <ludovic@ludovic-brenta.org>
Subject: Re: children unity
Date: Tue, 06 Sep 2005 20:14:05 +0200
Date: 2005-09-06T20:14:05+02:00	[thread overview]
Message-ID: <87ll2aqd1u.fsf@ludovic-brenta.org> (raw)
In-Reply-To: 1126025898.866369.318320@g47g2000cwa.googlegroups.com

"nicolas.b" <nicolas.blanpain@fr.thalesgroup.com> writes:
> this is an example :
>
> generic
>    type Toto is private;
> package Father is
> ...
> end Father;
>
> generic
>    type Titi is private;
> procedure Father.Children (...);
>
> My question : How can i use the children unity Father.Children ?
> package Inst_Father is new Father (Toto => ...);
> procedure Inst_Children is new Father.Children (Titi => ...); --

procedure Inst_Children is new Inst_Father.Children (Titi => ...);

> compilation error ???
>
> can you explain me,

A child unit cannot be the child of a generic, because the generic
does not exist in the executable program.  Instead, you can have
children of real units which are instances of a generic.

Corollary: any child of a generic unit must also be declared generic,
e.g.

generic
   ...
package P is ...
end P;

generic -- required even if no parameters
package P.Q is
   ...
end P.Q;

HTH

-- 
Ludovic Brenta.



  parent reply	other threads:[~2005-09-06 18:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-06 16:58 children unity nicolas.b
2005-09-06 18:01 ` Martin Krischik
2005-09-06 18:14 ` Ludovic Brenta [this message]
2005-09-06 18:17 ` 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