At the time of learning "design mode", encountered this problem, at that time is not very understanding, now think back, do a small summary.
1. What is shallow copy
Analysis under the above picture, at first there is a Tom reference type of the variable point to the heap of a zoo object, the zoo has its own properties such as area, size, of course, there will also be animals, so the zoo point to the Duck object, if you take a shallow copy at this time, the final effect as shown, For the reference object, when we take a shallow copy, we simply copy its address and do not create a new object on the heap.
2. What is deep copy
Know the shallow copy, deep copy is good to understand, or see, if you take a deep copy, it is to refer to the members of the object also copied one copy. The actual process is to create a new reference to the new object, and then copy the data contained in the object.
Deep copy Or Shallow copy