Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions features/rfc-oop-aggregates-and-assignments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,7 @@ needs to be maintained equal to the parents.

procedure Root'Clone (Self : Root; To : in out Root) is
begin
Free (To.A);
To.A := new Integer'(Self.A.all);
To.A.all := Self.A.all;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intent here is to demonstrate cleanup of the destination as well as deep copy. Perhaps using a string access instead of an integer will be better, let me see how to rewrite the example for that.

end Root'Clone;

procedure Root'Adjust (Self : in out Root; From : Root) is
Expand All @@ -172,8 +171,7 @@ needs to be maintained equal to the parents.
procedure Child'Clone (Self : Child; To : in out Child) is
begin'
Root (To) := Root (Self);
Free (To.B);
To.B := new Integer'(Self.B.all);
To.B.all := Self.B.all;
end Child'Clone;

procedure Child'Adjust (Self : in out Child; From : Root) is
Expand Down