comp.lang.ada
 help / color / mirror / Atom feed
* implementation for multiple stacks
@ 1997-10-01  0:00 FloydJen
  1997-10-01  0:00 ` Peter Amey
  0 siblings, 1 reply; 2+ messages in thread
From: FloydJen @ 1997-10-01  0:00 UTC (permalink / raw)



How do i write the push and pop etc. procedures for multiple stacks?
FloydJen@aol.com




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: implementation for multiple stacks
  1997-10-01  0:00 implementation for multiple stacks FloydJen
@ 1997-10-01  0:00 ` Peter Amey
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Amey @ 1997-10-01  0:00 UTC (permalink / raw)



FloydJen wrote:
> 
> How do i write the push and pop etc. procedures for multiple stacks?
> FloydJen@aol.com

This is a classic use for an abstract data type.  Declare a package
exporting a private stack type.  The stack can be implemented as a 
record with an array for the stack and a scalar for the stack pointer.
Operations will have an in out parameter of the private stack type.  
Users of the package declare themselves a variable of the abstract stack 
type at the point of use and use the operations provided by the package 
to manipulate it.  Multiple instances of variables of the stack type can 
exist at once and remain independent.  

Peter




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1997-10-01  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-10-01  0:00 implementation for multiple stacks FloydJen
1997-10-01  0:00 ` Peter Amey

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