comp.lang.ada
 help / color / mirror / Atom feed
From: James and Jessica Bear <jamesjb@peak.org>
Subject: Re: Help on arrays of tagged types
Date: 1998/01/13
Date: 1998-01-13T00:00:00+00:00	[thread overview]
Message-ID: <34BC054C.5DB2@peak.org> (raw)
In-Reply-To: mheaney-ya023680000901982031530001@news.ni.net


[ headers snipped ]
> >>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.
> >
	[ snip ]

Hello.  This problem is quite similar to one I have been having also.
I am trying to create a linked list type for objects derived from a
root tagged type.  

The goal is to have a homogenous Linked_List object, that stores objects
of a tagged type derived from "Root_Data".  So you could set up as
follows:

	Socket_List : Linked_List;
	Descriptor_List : Linked_List;
	etc.

The list is set up analogously to the example below, but the problem
arises 
when I try to access the elements of the list. I think the problem is
that 
I try to convert from "access Root_Data'Class" to "access <type derived
from Root_Data>",
which cannot work because it would entail extending the structure of the
object to the
derived type.

> 
> type Root_Data_Class_Access_All is access all Root_Data'Class;
> 
> type Root_Data_Array is
>    array (Positive range <>) of Root_Data_Class_Access_All;
> 

Should I be using generics for this instead?

Thanks for any and all help. :)
James




  reply	other threads:[~1998-01-13  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 ` Stephen Leake
1998-01-09  0:00 ` Matthew Heaney
1998-01-09  0:00   ` Matthew Heaney
1998-01-13  0:00     ` James and Jessica Bear [this message]
1998-01-13  0:00       ` 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