From: chico <manobla@sunshine.cs.biu.ac.il>
Subject: Help in OOP - abstract, tagged and generic
Date: 1996/04/09
Date: 1996-04-09T00:00:00+00:00 [thread overview]
Message-ID: <4ke902$bua@post.tau.ac.il> (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;
reply other threads:[~1996-04-09 0:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox