Sequnce Abstract Class
MC logo

Sequnce Abstract Class

Ada Code Examples

<<Objects 1 Download Sequnce Class Body>>
-- A sequence is something that advances, like a counter.
package SeqPack is
   -- Sequence is tagged (has dynamic type), abstract (cannot create any
   -- variables of this type), and private (no client-serviceableparts inside).
   type Sequence is abstract tagged private;

   -- Here are our common operations.

   -- Move to the next item in the sequence.
   procedure Next(S: in out Sequence) is abstract;

   -- Get the current item.
   function Value(S: Sequence) return Integer is abstract;

   -- Print the item.  This just prints the Value.
   procedure Put(S: Sequence'class);

      type Sequence is abstract tagged null record;
end SeqPack;
<<Objects 1 Sequnce Class Body>>