-- Chapter 23 - Program 4 with Ada.Text_IO, Ada.Integer_Text_IO, Conveyance5; use Ada.Text_IO, Ada.Integer_Text_IO, Conveyance5; procedure Vehicle5 is Hummer : aliased TRANSPORT; Limo : aliased CAR; Chevy : aliased CAR; Dodge : aliased TRUCK; Ford : aliased TRUCK; Schwinn : aliased BICYCLE; type TRANSPORT_ACCESS is access all TRANSPORT'Class; Any_Pt : TRANSPORT_ACCESS; begin Set_Values(Hummer, 4); Set_Values(Limo, 8); Set_Values(TRANSPORT(Limo), 4); Set_Values(Chevy, 5); Set_Values(TRANSPORT(Chevy), 4); Set_Values(Dodge, 6, 3); Set_Values(Ford, 4, 3); Set_Values(Schwinn, 2); -- Print out the data for the Ford truck just to pick on one. Put("The Ford truck has"); Put(Get_Wheels(Ford), 2); Put(" wheels, and can carry"); Put(Get_Passenger_Count(Ford), 2); Put(" passengers."); New_Line; -- Now, let's call the class-wide procedure 6 times. Print_Values(Hummer); Print_Values(Limo); Print_Values(Chevy); Print_Values(Dodge); Print_Values(Ford); Print_Values(Schwinn); Any_Pt := Hummer'Access; Describe(Any_Pt.all); Any_Pt := Limo'Access; Describe(Any_Pt.all); Any_Pt := Chevy'Access; Describe(Any_Pt.all); Any_Pt := Dodge'Access; Describe(Any_Pt.all); Any_Pt := Ford'Access; Describe(Any_Pt.all); Any_Pt := Schwinn'Access; Describe(Any_Pt.all); end Vehicle5; -- Result of execution -- -- The Ford truck has 4 wheels and can carry 3 passengers. -- This vehicle has 4 wheels. -- This vehicle has 4 wheels. -- This vehicle has 4 wheels. -- This vehicle has 6 wheels. -- This vehicle has 4 wheels. -- This vehicle has 2 wheels. -- We are in the TRANSPORT procedure. -- We are in the CAR procedure. -- We are in the CAR procedure. -- We are in the TRUCK procedure. -- We are in the TRUCK procedure. -- We are in the BICYCLE procedure.