comp.lang.ada
 help / color / mirror / Atom feed
From: Dale Stanbrough <dale@goanna.cs.rmit.edu.au>
Subject: Re: Classwide Container
Date: 1998/06/08
Date: 1998-06-08T00:00:00+00:00	[thread overview]
Message-ID: <6lhnis$222$1@goanna.cs.rmit.edu.au> (raw)
In-Reply-To: 357BFD07.37A379C3@gbr.msd.ray.com


Yves Malette writes...

"I am having trouble creating an array of  classes....."


	type Object is tagged null record;
	
	type Object_Ptr is access all Object'class;
	
	
	procedure Dispatch (Item : Object);
	
	
	type Object_Class_Array is array (Integer range <>) of Object_Ptr;
	
	
	
	type A is new Object with null record;
	
	procedure Dispatch (Item : A);
	
	etc.
	
	
	...
	   List : Object_Class_Array (1..3);
		
	begin
	   List (1) := new Object;
	   List (2) := new A;
	   List (3) := new B;
	   
	   
	   for i in List'range loop
	      Dispatch (List (i).all);
	   end loop;
	end;


Hope this helps...

Dale




      reply	other threads:[~1998-06-08  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-06-08  0:00 Classwide Container Yves Malette
1998-06-08  0:00 ` Dale Stanbrough [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