comp.lang.ada
 help / color / mirror / Atom feed
From: dale@cs.rmit.edu.au (Dale Stanbrough)
Subject: Re: I have a question about the "record" in ADA
Date: 1999/05/22
Date: 1999-05-21T22:35:26+00:00	[thread overview]
Message-ID: <dale-2205990835260001@r1021c-20.ppp.cs.rmit.edu.au> (raw)
In-Reply-To: 7i453r$l5m$1@wanadoo.fr

In article <7i453r$l5m$1@wanadoo.fr>, "mike" <blsoul@hotmail.com> wrote:

> Sorry for my bad English :)
> How could I do to access to the different part of a record which is
> a generic parameter in a generic package?
> because my function in my package must acces in the record.
> Mike



If you want to access particular fields, then you don't _really_
want to pass in any record (i.e. you don't want it as a generic
parameter), you are wanting to pass in a -particular- record.
Otherwise how in the world would you know what fields are in there?

Solutions are...

You can modify the parameters to the subprograms in the generic to
include the record type you want to access.


You can pass in a _particular_ tagged type record as a generic 
parameter.

   generic
      type Element is new Root_Type with private;

(i think!)


You could pass in accessor functions that will extract the information
you want out of the generic parameter.
e.g.
   generic
      type element is private;
      with function Get_Field1 (Item : Element) return X;
      with function Get_Field2 (Item : Element) return Y;
      etc.


Dale




  parent reply	other threads:[~1999-05-22  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-05-21  0:00 I have a question about the "record" in ADA mike
1999-05-21  0:00 ` dennison
1999-05-22  0:00 ` Dale Stanbrough [this message]
1999-06-03  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