blob: ef3de83f0183290088c84c3c6f49c1ce5f1b0b7e [file] [log] [blame]
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Text_IO; use Ada.Text_IO;
package body Derived_Type3_Pkg is
type Parent is tagged null record;
type Child is new Parent with
record
Image : Ada.Strings.Unbounded.Unbounded_String;
end record;
function Set_Image return Child'class is
Local_Data : Child;
begin
Local_Data.Image := To_Unbounded_String ("Hello");
return Local_Data;
end Set_Image;
procedure Proc1 is
The_Data : Parent'class := Set_Image;
begin
Put_Line ("Child'Alignment =" & Child'Alignment'Img);
Put_Line ("The_Data'Alignment =" & The_Data'Alignment'Img);
end;
procedure Proc2 is
procedure Nested (X : Parent'Class) is
The_Data : Parent'Class := X;
begin
Put_Line ("Child'Alignment =" & Child'Alignment'Img);
Put_Line ("The_Data'Alignment =" & The_Data'Alignment'Img);
end;
The_Data : Parent'Class := Set_Image;
begin
Nested (The_Data);
end;
end Derived_Type3_Pkg;