comp.lang.ada
 help / color / mirror / Atom feed
* children unity
@ 2005-09-06 16:58 nicolas.b
  2005-09-06 18:01 ` Martin Krischik
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: nicolas.b @ 2005-09-06 16:58 UTC (permalink / raw)


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 => ...); --
compilation error ???

can you explain me,

thanks,




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: children unity
  2005-09-06 16:58 children unity nicolas.b
@ 2005-09-06 18:01 ` Martin Krischik
  2005-09-06 18:14 ` Ludovic Brenta
  2005-09-06 18:17 ` Georg Bauhaus
  2 siblings, 0 replies; 4+ messages in thread
From: Martin Krischik @ 2005-09-06 18:01 UTC (permalink / raw)


nicolas.b wrote:

> 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 => ...); --
> compilation error ???

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

But really *any* tutorial tells you that!!

Martin

-- 
mailto://krischik@users.sourceforge.net
Ada programming at: http://ada.krischik.com



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: children unity
  2005-09-06 16:58 children unity nicolas.b
  2005-09-06 18:01 ` Martin Krischik
@ 2005-09-06 18:14 ` Ludovic Brenta
  2005-09-06 18:17 ` Georg Bauhaus
  2 siblings, 0 replies; 4+ messages in thread
From: Ludovic Brenta @ 2005-09-06 18:14 UTC (permalink / raw)


"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.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: children unity
  2005-09-06 16:58 children unity nicolas.b
  2005-09-06 18:01 ` Martin Krischik
  2005-09-06 18:14 ` Ludovic Brenta
@ 2005-09-06 18:17 ` Georg Bauhaus
  2 siblings, 0 replies; 4+ messages in thread
From: Georg Bauhaus @ 2005-09-06 18:17 UTC (permalink / raw)


nicolas.b wrote:

> 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 => ...); --
> compilation error ???

After you have created an instance of Father, Inst_Father,
you can create an instance of the Children procedure.
But instantiate Inst_Father.Children, not Father.Children.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-09-06 18:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-06 16:58 children unity nicolas.b
2005-09-06 18:01 ` Martin Krischik
2005-09-06 18:14 ` Ludovic Brenta
2005-09-06 18:17 ` Georg Bauhaus

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