comp.lang.ada
 help / color / mirror / Atom feed
From: "Rick Santa-Cruz" <rick_santa_cruz75@msn.com>
Subject: generic with procedure
Date: Tue, 28 Sep 2004 23:52:13 +0200
Date: 2004-09-28T23:52:13+02:00	[thread overview]
Message-ID: <cjcmeu$ljq$03$1@news.t-online.com> (raw)

Hi,

I am starting to read a bit about generic programming and I am a bit 
confused from it, cause it seems to me a bit different to 
template-programming in C++.
Sadly I can't figure out the difference between the following:
1.) generic
        type Element is private;
    package MyContainers is
        type MyContainer is private;
        procedure Some_Proc(Item : Element);
    end MyContainer;
2.) generic
        type Element is private;
    package MyContainers is
        type MyContainer is private;
     generic
        with procedure Some_Proc(Item : Element);
    end MyContainer;

I only have seen the "with procedure/function..." in the following sense:
generic
    type T is private;
    with procedure Some_Proc(Item : Element);
And I thought the sense of this is to tell the compiler that T has to 
declare the procedure Some_Proc, so that I can write in the body of my 
package something like:
....
Item1, Item2: Element

...
Item1.Some_Proc(Item2);

I sadly don't understand when to use the 2. case?

Thanks in advance,
Rick 





             reply	other threads:[~2004-09-28 21:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-28 21:52 Rick Santa-Cruz [this message]
2004-09-28 23:56 ` generic with procedure Stephen Leake
2004-09-29  0:06   ` Rick Santa-Cruz
2004-09-29 23:47     ` Stephen Leake
2004-09-29  2:11 ` 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