comp.lang.ada
 help / color / mirror / Atom feed
From: Matthew Heaney <matthewjheaney@earthlink.net>
Subject: Re: Bases 1.52
Date: Sun, 14 Sep 2003 06:51:36 GMT
Date: 2003-09-14T06:51:36+00:00	[thread overview]
Message-ID: <uad97amkh.fsf@earthlink.net> (raw)
In-Reply-To: 1301057.xhkpTmYQhd@linux1.krischik.com

Martin Krischik <krischik@users.sourceforge.net> writes:

> Yes, but to my knowlege you cant say:
> 
> type Item'Class is private;

This is all wrong.  If you have this generic formal type:

generic
   type T (<>) is private;
package GP is ...;

and this actual type:

package Q is
   type T is tagged private;
...
end Q;

Then you can instantiate the generic package like this:

package P is new GP (Q.T'Class);

The type T'Class is a real type.  It has a funny spelling, but it's a
real type.

You can declare objects of that type, both on the stack, like this:

  O : T'Class := ...;

and on the heap, like this:

  O : T_Class_Access := new T'Class'(Item);

You can write subprogram parameters --including function return types--
with that type.

And you can use T'Class as the generic actual type in a generic
instantiation.




  parent reply	other threads:[~2003-09-14  6:51 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-02 18:59 Bases for the Design of a Standard Container Library for Ada Mário Amado Alves
2003-09-03 20:30 ` Warren W. Gay VE3WWG
2003-09-03 21:07   ` David C. Hoos
2003-09-04  2:19 ` Randy Brukardt
2003-09-04 11:56   ` Mário Amado Alves
2003-09-05  3:55     ` Randy Brukardt
2003-09-05  5:17       ` Matthew Heaney
2003-09-05 11:45         ` Amado Alves
2003-09-05 19:40           ` Randy Brukardt
2003-09-05 15:10         ` Martin Krischik
2003-09-07 18:03           ` Matthew Heaney
2003-09-08 12:54             ` Mário Amado Alves
2003-09-08 17:02 ` Bases 1.57 Martin Krischik
2003-09-08 17:07 ` Bases 1.58 Martin Krischik
2003-09-09 16:37 ` Bases 1.52 Martin Krischik
2003-09-10  7:49   ` Mário Amado Alves
2003-09-11 15:03     ` Martin Krischik
2003-09-12 10:58       ` Mário Amado Alves
2003-09-12 13:05         ` Martin Dowie
2003-09-12 17:49           ` maximum number of lines per spec (was: Bases 1.52) Mário Amado Alves
2003-09-13 12:18             ` Marin David Condic
2003-09-12 15:36         ` Bases 1.52 Martin Krischik
2003-09-14  6:51       ` Matthew Heaney [this message]
2003-09-14 14:32         ` Martin Krischik
2003-09-14 18:22         ` Robert I. Eachus
2003-09-14 22:56           ` Nick Roberts
2003-09-15  0:17             ` Robert I. Eachus
2003-09-14  6:45   ` Matthew Heaney
replies disabled

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