OO Integer Stack Package
MC logo
 

OO Integer Stack Package

Ada Code Examples


<<OO Generalized Stack Body Download OO Integer Stack Body>>
--
-- Declarations for integer stack.  This uses the generalized stack to
-- permit integers to be pushed by extending the stack data class.
--
with GenStack; use GenStack;

package IStack is
   -- Type of data on the stack.  It extends StackData so we can push these
   -- objects.
   type IntStackData is new StackData with private;

   -- An easy to way to build these.
   function IDat(I: Integer) return IntStackData;

   -- Get the value.
   function IValue(R: IntStackData) return Integer;

   private
      -- Its really just a record with an integer in it.
      type IntStackData is new StackData with record
         V: Integer;
      end record;
end IStack;
<<OO Generalized Stack Body OO Integer Stack Body>>