comp.lang.ada
 help / color / mirror / Atom feed
* Generic type
@ 2000-08-11  0:00 Matthias Teege
  2000-08-11  0:00 ` Ted Dennison
  0 siblings, 1 reply; 2+ messages in thread
From: Matthias Teege @ 2000-08-11  0:00 UTC (permalink / raw)



Moin,

I've wrote an generic packages to store things in an
table. The generic looks like this: 

generic

   Rows : in Positive;       -- Length of table
   type Info (<>) is private;

package Table is

   type Tabelle is limited private; 
   subtype Id is Positive range 1 .. Rows;
..

I made a new instance with this statement: 

package Cline is
   new Table (Kapazitaet => 10, Nutz_Info =>
   String);

wich works great. But how can I use my own types?

type Argument;
package Cline is
   new Table (Kapazitaet => 10, Nutz_Info => Argument);

wont work. ;-)

Many thanks
Matthias

-- 
Matthias Teege -- matthias@mteege.de -- http://emugs.de
make world not war
PGP-Key auf Anfrage





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

* Re: Generic type
  2000-08-11  0:00 Generic type Matthias Teege
@ 2000-08-11  0:00 ` Ted Dennison
  0 siblings, 0 replies; 2+ messages in thread
From: Ted Dennison @ 2000-08-11  0:00 UTC (permalink / raw)


In article <87zomkgvgg.fsf@moon.mteege.de>,
  Matthias Teege <matthias@mteege.de> wrote:
> generic
>
>    Rows : in Positive;       -- Length of table
>    type Info (<>) is private;
>
> package Table is
> ..
(new source file)
> type Argument;
> package Cline is
>    new Table (Kapazitaet => 10, Nutz_Info => Argument);
>
> wont work. ;-)

That's because Argument hasn't been fully defined. You'll have to move
the definition of "Cline" to after the full definition of "Argument" if
you want to use Argument as an actual.

Well...it could *also* be because you got the names of the formals wrong
in the declaration, but I'll assume that's a typo. :-)

--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html


Sent via Deja.com http://www.deja.com/
Before you buy.




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

end of thread, other threads:[~2000-08-11  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-08-11  0:00 Generic type Matthias Teege
2000-08-11  0:00 ` Ted Dennison

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