with Ada.Finalization;


  type Uncontrolled (<>) is abstract tagged limited private;

  with procedure Finalize (Object: in out Uncontrolled);

package Add_Finalization.To_Limited_Uncontrolled is

  type Controlled is new Uncontrolled with private;


  type Component (Parent: access Controlled) is
    new Ada.Finalization.Limited_Controlled with null record;

  type Controlled is new Uncontrolled with record
    Controller: Component (Controlled'Access);
  end record;

  procedure Finalize (Object: in out Component);

end Add_Finalization.To_Limited_Uncontrolled;

package body Add_Finalization.To_Limited_Uncontrolled is

  procedure Finalize (Object: in out Component) is
    Finalize (Uncontrolled (Object.Parent.all));
  end Finalize;

end Add_Finalization.To_Limited_Uncontrolled;

Back to text.
Zurück zum Text.