Tools.h++ Manual
12-4 104011 Tandem Computers Incorporated
12
Figure 12-1
Bag
before a copy
A shallow and deep copy of this collection would look like (respectively):
Figure 12-2 Shallow and deep copy of collection
Note – The deep copy not only made a copy of the bag itself, but also,
recursively, any objects within it.
Before
Peggy
Lee
Fred
Nell
Deep CopyShallow Copy
Bag 2Bag 1
Peggy
Lee
Nell
Fred
Bag 1
Peggy
Lee
Nell
Fred
Bag 2
Peggy
Lee
Nell
Fred