with Persons; use Persons;
with Dates; use Dates;
package Personnel is
------------------------------------------------------------------
--| specification for Personnel, which provides a type Employee,
--| a derivative of Persons.Person. Note that the operations on
--| objects of type Persons.Person are inherited by objects of
--| type Employee, so we need selectors only for the new
--| fields! As in the case of Persons, we place the constructor
--| in an inner package.
--| Author: Michael B. Feldman, The George Washington University
--| Last Modified: September 1995
------------------------------------------------------------------
type Employee is new Person with private;
-- Here is where Employee is derived; the extension fields are
-- also PRIVATE, so clients cannot access them directly.
type IDType is new Positive range 1111..9999;
-- selectors
function StartOf (Whom: Employee) return Date;
function IDOf (Whom: Employee) return IDType;
-- Pre: Whom is defined
-- Post: return the appropriate field values
procedure Put(Item: Employee);
-- Pre: Item is defined
-- Post: Item is displayed
package Constructors is
-- as in Persons, we use an inner package to prevent the
-- constructor from being inherited by further derivatives
-- of Employee
function MakeEmployee(Name : String;
Gender : Genders;
BirthDate: Date;
StartDate: Date;
ID : IDType) return Employee;
-- Pre: Name, Gender, BirthDate, StateDate, and ID are defined
-- Post: Whom contains the desired field values
end Constructors;
private
type Employee is new Person with record
ID : IDType := 1111;
StartDate : Date;
end record;
end Personnel;