comp.lang.ada
 help / color / mirror / Atom feed
From: "Rick Santa-Cruz" <rick_santa_cruz75@msn.com>
Subject: Re: questions to generic
Date: Wed, 29 Sep 2004 11:58:13 +0200
Date: 2004-09-29T11:58:13+02:00	[thread overview]
Message-ID: <cje105$7lc$02$1@news.t-online.com> (raw)
In-Reply-To: cjd5uv$aq4$2@a1-hrz.uni-duisburg.de

Hi,

> yes, the way you have done.
>
> : where Gen_Test_Client is the start-procedure?
>
> no. It has to be instantiated somewhere to become a real procedure.
And how and where do I have to instantiate the procedure then?

>
> : 2.) How is it possible to create a generic child package?
>
> You might find it useful to think of child packages as nested
> packages. Consider the steps it takes to make an instance
> of the outer package. After you have an instance of the outer
> package, you are back at step 1, where you instantiate some generic
> package :-)
So is it this way correct:
package Pack1 is
 generic
  type Element is private;
 package Child_Pack is
  procedure Proc(El: Element);
 end Child_Pack;
end Pack1;

--body
package body Pack1 is
 package bodY Child_Pack is
  procedure Proc(El: Element) is
   El1: Element;
  begin
   El1:= El;
  end Proc;
 end Child_Pack;
end Pack1;

-- test-client:
with Pack1; -- by the way when I write here: with Pack1.Child_Pack; I get a 
compilation-error. Why?
procedure Gen_Test_Client is
  package S_2 is new Pack1.Child_Pack(Integer);
....


Thanks,
Rick 





  reply	other threads:[~2004-09-29  9:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-28 23:58 questions to generic Rick Santa-Cruz
2004-09-29  2:17 ` Georg Bauhaus
2004-09-29  9:58   ` Rick Santa-Cruz [this message]
2004-09-29 11:33     ` Georg Bauhaus
2004-09-29 14:52       ` Björn Persson
2004-09-29 17:11         ` Georg Bauhaus
2004-09-29 14:50     ` Björn Persson
replies disabled

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