comp.lang.ada
 help / color / mirror / Atom feed
* generic with procedure
@ 2004-09-28 21:52 Rick Santa-Cruz
  2004-09-28 23:56 ` Stephen Leake
  2004-09-29  2:11 ` Georg Bauhaus
  0 siblings, 2 replies; 5+ messages in thread
From: Rick Santa-Cruz @ 2004-09-28 21:52 UTC (permalink / 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 





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

end of thread, other threads:[~2004-09-29 23:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-28 21:52 generic with procedure Rick Santa-Cruz
2004-09-28 23:56 ` Stephen Leake
2004-09-29  0:06   ` Rick Santa-Cruz
2004-09-29 23:47     ` Stephen Leake
2004-09-29  2:11 ` Georg Bauhaus

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