1 with Ada
.Strings
.Unbounded
; use Ada
.Strings
.Unbounded
;
2 with Ada
.Text_IO
; use Ada
.Text_IO
;
4 package body Derived_Type3_Pkg
is
6 type Parent
is tagged null record;
8 type Child
is new Parent
with
10 Image
: Ada
.Strings
.Unbounded
.Unbounded_String
;
13 function Set_Image
return Child
'class is
16 Local_Data
.Image
:= To_Unbounded_String
("Hello");
21 The_Data
: Parent
'class := Set_Image
;
23 Put_Line
("Child'Alignment =" & Child
'Alignment'Img);
24 Put_Line ("The_Data'Alignment =" & The_Data'Alignment'Img
);
29 procedure Nested
(X
: Parent
'Class) is
30 The_Data
: Parent
'Class := X
;
32 Put_Line
("Child'Alignment =" & Child
'Alignment'Img);
33 Put_Line ("The_Data'Alignment =" & The_Data'Alignment'Img
);
36 The_Data
: Parent
'Class := Set_Image
;
42 end Derived_Type3_Pkg
;