This chapter discusses some of the subtleties involved in copying objects. We introduce the concept of shallow versus deep copying and discuss how to make copies under the Foundation framework.
origin = pt;
In this example,
pt are both
XYPoint objects with two integer instance variables called
Recall that the effect of the assignment is to simply copy the address of the object
origin. At the end of the assignment operation, both variables point to the same location in memory. Making changes to the instance variables with a message such as
[origin setX: 100 andY: ...