comp.lang.ada
 help / color / mirror / Atom feed
From: "Boaz" <boaz@pipeline.com>
Subject: passing pointer of different type to one procedure
Date: 1997/04/16
Date: 1997-04-16T00:00:00+00:00	[thread overview]
Message-ID: <01bc4a80$713ca380$52bd0c26@cat> (raw)


Hi there,

I am trying to write a sort procedure for a data base project.  I have 2
different records.  Instead of having 2 instances for that sort procedure,
I am thinking to use just one that take a pointer of either one of the
records type.

this is my test program but I don't quite sure how to set it up :

with text_io; use text_io;
with ada.float_text_io; use ada.float_text_io;

procedure test is


type record_pointer is access all record;  <-- error

type a is record
	key : float;
	d : integer;
end record;

type b is record
	key : float;
	e : float;
end record;

rp : record_pointer;
d1  : aliased a;
d2	: aliased b;


procedure sort(p : in record_pointer) is
begin
	put(p.key);
end sort;

begin

	d1.key := 1.0;
	d2.key := 5.0;
	rp := d1'access;
	sort(rp);
	rp := d2'access;
	sort(rp);
end test;





             reply	other threads:[~1997-04-16  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-04-16  0:00 Boaz [this message]
1997-04-17  0:00 ` passing pointer of different type to one procedure John Harbaugh
1997-04-19  0:00   ` Robert Dewar
     [not found] ` <33555ECA.44A8@bix.com>
1997-04-17  0:00   ` Robert Dewar
     [not found]   ` <01bc4ad3$f3702860$6aba0c26@cat>
1997-04-17  0:00     ` Tom Moran
1997-04-18  0:00 ` Mark & Zurima McKinney
replies disabled

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