comp.lang.ada
 help / color / mirror / Atom feed
* Help in OOP - abstract, tagged and generic
@ 1996-04-09  0:00 chico
  0 siblings, 0 replies; only message in thread
From: chico @ 1996-04-09  0:00 UTC (permalink / raw)


I would Like to write an abstract package that will implement Sets in
two ways, one with list and one with array, I need to declare a base
type and then derive from it. doe's anybody has something like it
or can help me write it.(I don't know how to write the spec for the
the derived type)

the base is :
with Gnat.IO; use Gnat.IO;

package Sets is 

generic
   type Set_Element is private;

package Abstract_Sets is
  
   type Set is abstract tagged private;

   function Empty return Set is abstract;
   --     Empty Set
   function Unit (Element: Set_Elemet) return Set is abstract;
   --     build Set with 1 element
   function Union (Left, Right: Set) return Set is abstract;
   --     union of two sets
   function intersection (Left, Right: Set) return Set is abstract;
   --     intersection of two sets
   procedure Take (From: in out Set;
                           Element: out Set_Elemet) is abstract;
   --     remove an element from a set

private
   type Set is abstract tagged null record;
end Abstract_Sets;






^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1996-04-09  0:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-04-09  0:00 Help in OOP - abstract, tagged and generic chico

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