@Joe: Specifically, I'm having trouble understanding the difference between retain and assign in property declarations.
If the instance variable is called "myName", assign would do something roughly equivalent to this: myName = newName;
Retain would do this: [myName autorelease];
myName = [newName retain];
Copy would do this: [myName autorelease];
myName = [newName copy];
This isn't necessarily the exact code that gets generated, but it has the same basic effect.
You also asked if the retain keyword would be the equivalent of "[[caption setCaption:newCaption]retain];". The answer is no, but I'm not sure how to quickly explain why that is the case. I hope the above clears that up.
If you have garbage collection on, assign and retain are the same thing.
by Scott Stevenson — May 29
If the instance variable is called "myName", assign would do something roughly equivalent to this:
myName = newName;
Retain would do this:
[myName autorelease]; myName = [newName retain];
Copy would do this:
[myName autorelease]; myName = [newName copy];
This isn't necessarily the exact code that gets generated, but it has the same basic effect.
You also asked if the retain keyword would be the equivalent of "[[caption setCaption:newCaption]retain];". The answer is no, but I'm not sure how to quickly explain why that is the case. I hope the above clears that up.
If you have garbage collection on, assign and retain are the same thing.