From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,26b4788057a37408 X-Google-Attributes: gid103376,public From: Peter Amey Subject: Re: implementation for multiple stacks Date: 1997/10/01 Message-ID: <3432AE2A.35C8@praxis-cs.co.uk>#1/1 X-Deja-AN: 277038186 References: <19971001052200.BAA25591@ladder02.news.aol.com> Organization: Praxis Critical Systems Newsgroups: comp.lang.ada Date: 1997-10-01T00:00:00+00:00 List-Id: 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