I am still learning …, so for the following property
@property (copy) NSNumber *foo;
What the copy really do? make a copy of the (value of) foo and put it to new place? Just like a copy constructor?
And also to clarify, the following is basically doing a AddRef, right?
@property (retain) NSNumber *foo;
In general,
NSNumberis immutable — I’d expect thatcopyin those cases would be implemented usingretain:Well, synthesizing it will add the reference counting boilerplate – the actual operation is more complex and takes the generalized form: