comp.lang.ada
 help / color / mirror / Atom feed
From: Dale Stanbrough <dale@goanna.cs.rmit.edu.au>
Subject: Instantiation of child generics?
Date: 1996/07/26
Date: 1996-07-26T00:00:00+00:00	[thread overview]
Message-ID: <4t9itp$imd@goanna.cs.rmit.edu.au> (raw)


Hi,

I'ld like to create an abstract generic queue package with bounded
and unbounded children. However I have been thwarted in all attempts
to instantiate them. Also I don't really understand the rules for
instantiaion of child generics. Can anyone explain them?


e.g. 

	generic
		type element is private;
	package queues is 
		type queue is abstract tagged null record;
		
		procedure init return queue is abstract;
		
		procedure enqueue(item:in out queue; item:element) is abstract;

		-- etc
	end queues;
	
	
	generic
		size	:natural;
	package queues.bounded is
			
		type queue is new queues.queue with private;
		
		procedure init return queue is abstract;
		
		procedure enqueue(item:in out queue; item:element) is abstract;

	private
		type queue is new queues.queue with null record; -- for now...
	end;


How do I instantiate this?

	with queues.bounded;
	package myQ is new queues.bounded(integer, 5);
	
results in Gnat telling me "invalid prefix in selected component "queues""

Also will my (re)use of the identifier "queue" in the packages cause any
problems for me? It seems to compile ok, but i'm concerned that there might
be some nasty visibility issue lurking around the corner...

Thanks,

Dale




             reply	other threads:[~1996-07-26  0:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-07-26  0:00 Dale Stanbrough [this message]
1996-07-26  0:00 ` Instantiation of child generics? Tucker Taft
1996-07-26  0:00   ` Kevin J. Weise
1996-07-27  0:00     ` Robert A Duff
1996-07-30  0:00       ` Dale Stanbrough
1996-07-30  0:00         ` Robert A Duff
1996-07-26  0:00 ` Robert A Duff
replies disabled

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