-- File: conveyance.ads -- conveyance package interface -- -- Prepared by Prof. Spiegel -- Copyright © 1988-1998 Coronado Enterprises - Last update, February 1, 1998 -- Gordon Dodrill - dodrill@swcp.com with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Float_Text_IO; use Ada.Text_IO, Ada.Integer_Text_IO, Ada.Float_Text_IO; package conveyance is -- Begin with a basic transportation type. type TRANSPORT is tagged private; procedure Set_Values(Vehicle_In : in out TRANSPORT; Wheels_In : INTEGER); function Get_Wheels(Vehicle_In : TRANSPORT) return INTEGER; procedure Describe(Vehicle_In : TRANSPORT); -- Extend the basic type to a CAR type. type CAR is new TRANSPORT with private; procedure Set_Values(Vehicle_In : in out CAR; Passenger_Count_In : INTEGER); function Get_Passenger_Count(Vehicle_In : CAR) return INTEGER; procedure Describe(Vehicle_In : CAR); -- Extend the basic type to a TRUCK type. type TRUCK is new TRANSPORT with private; procedure Set_Values(Vehicle_In : in out TRUCK; Wheels_In : INTEGER; Passenger_Count_In : INTEGER); function Get_Passenger_Count(Vehicle_In : TRUCK) return INTEGER; procedure Describe(Vehicle_In : TRUCK); -- Extend the basic type to the BICYCLE type. type BICYCLE is new TRANSPORT with private; procedure Describe(Vehicle_In : BICYCLE); -- Print_Values is a class-wide operation. It can accept objects -- of any type within the TRANSPORT heirarchy. procedure Print_Values(Any_Vehicle : TRANSPORT'Class); private type TRANSPORT is tagged record Wheels : INTEGER; end record; type CAR is new TRANSPORT with record Passenger_Count : INTEGER; end record; type TRUCK is new TRANSPORT with record Passenger_Count : INTEGER; end record; type BICYCLE is new TRANSPORT with null record; end conveyance;