comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <Stephen.Leake@gsfc.nasa.gov>
Subject: Re: Help on arrays of tagged types
Date: 1998/01/09
Date: 1998-01-09T00:00:00+00:00	[thread overview]
Message-ID: <34B66513.11D@gsfc.nasa.gov> (raw)
In-Reply-To: 34B37A65.607798A2@catalina-inter.net


mrada wrote:
> 
> Hi all,
> 
> I am racking my brains trying to figure out how to have a hetergenous
> array of tagged type data.  I have numerous packages all of which have
> a Data type inherited from one another.  I would like to declare an
> array who components can point to different "Data" type objects.
	                    ^^^
key word; "point". Use an array of class-wide access type;

type Root_Type is abstract tagged with null record;
type Root_Access_Type is access Root_Type'class;

type Heterogenous_Array_Type is array (foo) of Root_Access_Type;

Yes, this requires allocate/deallocate; that's the price you pay for
flexibility.

If the array elements are constant, they can be staticly declared,
avoiding allocate/deallocate.


> Chris Sparks

-- 
- Stephe




      parent reply	other threads:[~1998-01-09  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-01-07  0:00 Help on arrays of tagged types mrada
1998-01-09  0:00 ` Matthew Heaney
1998-01-09  0:00   ` Matthew Heaney
1998-01-13  0:00     ` James and Jessica Bear
1998-01-13  0:00       ` Matthew Heaney
1998-01-09  0:00 ` Stephen Leake [this message]
replies disabled

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