Clone: IStack;
The Clone method creates a copy of the stack.
Sub UserProc;
Var
Stack1, Stack2: IStack;
i: Integer;
Begin
Stack1 := New Stack.Create;
Stack2 := New Stack.Create;
For i := 0 To Math.RandBetweenI(50, 100) Do
Stack1.Push("Value " + Math.RandBetweenI(0, 100).ToString);
End For;
Stack2 := Stack1.Clone;
Stack1.Clear;
End Sub UserProc;
After executing the example the Stack2 stack contains a copy of the Stack1 stack.
See also: