3 -- Grant of Unlimited Rights
5 -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
6 -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
7 -- unlimited rights in the software and documentation contained herein.
8 -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
9 -- this public release, the Government intends to confer upon all
10 -- recipients unlimited rights equal to those held by the Government.
11 -- These rights include rights to use, duplicate, release or disclose the
12 -- released technical data and computer software in whole or in part, in
13 -- any manner and for any purpose whatsoever, and to have or permit others
18 -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
19 -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
20 -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
21 -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
22 -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
23 -- PARTICULAR PURPOSE OF SAID MATERIAL.
27 -- Check that an extended type can be derived from an abstract type,
28 -- where the abstract type is defined in a package, and the type derived
29 -- from it is defined in a distinct library package.
32 -- Declare an private (abstract) type; declare two primitive operations
33 -- of the type that are explicitly abstract.
34 -- Derive an extended type from the (private) abstract type, overriding
35 -- both of the primitive operations.
36 -- This test also checks to see that name overloading between abstract
37 -- and non-abstract functions is resolved correctly.
41 -- 06 Dec 94 SAIC ACVC 2.0
48 type DT_Type
is new Integer;
50 type Alert_Type
is abstract tagged record
51 Time_Of_Arrival
: DT_Type
;
54 type Log_File_Type
is range 0 .. 100;
56 Procedure Handle
(A
: in out Alert_type
) is abstract;
58 procedure Log
(A
: Alert_Type
;
59 L
: in out Log_File_Type
) is abstract;
61 procedure Set_Time
(A
: in out Alert_Type
);
63 function Correct_Time_Stamp
(A
: Alert_Type
) return Boolean;
65 Day_Time
: DT_Type
:= 100;
70 --=======================================================================--
72 package body C393007_0
is
75 function Time_Stamp
return DT_Type
is
77 Day_Time
:= Day_Time
+ 1;
81 procedure Set_Time
(A
: in out Alert_Type
) is
83 A
.Time_Of_Arrival
:= Time_Stamp
;
86 function Correct_Time_Stamp
( A
: Alert_Type
) return Boolean is
88 return (A
.Time_Of_Arrival
= Day_Time
);
89 end Correct_Time_Stamp
;
94 --=======================================================================--
102 type Normal_Alert_Type
is
103 new C393007_0
.Alert_Type
106 Log_File
: C393007_0
.Log_File_Type
:= C393007_0
.Log_File_Type
'First;
108 procedure Handle
(A
: in out Normal_Alert_Type
); -- Override is required
110 procedure Log
(A
: Normal_Alert_Type
; -- Override is required
111 L
: in out C393007_0
.Log_File_Type
);
114 package body C393007_1
is
115 use type C393007_0
.Log_File_Type
;
117 procedure Handle
(A
: in out Normal_Alert_Type
) is
123 procedure Log
(A
: Normal_Alert_Type
;
124 L
: in out C393007_0
.Log_File_Type
) is
126 L
:= C393007_0
."+"(L
, 1);
140 Alert_One
: C393007_1
.Normal_Alert_Type
;
143 Report
.Test
("C393007", "Check that an extended type can be derived " &
144 "from an abstract type");
147 if not Correct_Time_Stamp
(Alert_One
) then
148 Report
.Failed
("Wrong results from procedure Handle");
152 Report
.Failed
("Wrong results");