The former uses the property's point operator, which is equivalent to calling the ABC corresponding set method, and this sentence is the same: [Self setabc:nil];
The latter does not pass the property, directly accesses the member variable, and calls its release method.
For set method, using synthesize to let the system help us generate the set methods similar to the following:
-(void) SETABC: (ID) newabc{ if (_abc! = newabc) { [_abc release]; _ABC = [newabc retain]; is retain or copy depends on your property declaration when attributes }}
If the new value and the member are equal, there is no need to duplicate the assignment, if not equal, the new value needs to be assigned to the member, and the member _abc the original content is not required, here to call release to be released. (This specific reason is clearly written in the book of the Objective-c, please check).
So here, call self.abc = nil;
is tantamount to losing [_ABC release]; and _abc = nil;
SELF.ABC = nil; and [_ABC release]; Does not necessarily release the object, because the object may also be referenced by another, the intent of the operation here is: Other places with useless _abc I do not know, here _abc I do not need.
When using retain or copy of the property attributes, Self.abc = nil, equal to the following statement:
if (_abc!= nil)
{
[_ABC release];
_ABC = nil; Message sent to nil returns nil.
}
So it's a little easier to use.
The difference between self.abc = nil and [_ABC release] for iOS development