Both objectA
and objectB
will have a strong reference, so if they're both pointing to the same object, then it won't be deallocated until either both of them are set to nil
or they both go out of scope. This is of course assuming ARC is enabled. If ARC isn't enabled, then your object will only be deallocated if you call release
on it.
Now, under ARC, if you wanted only one of them to have a strong reference to the object, then you could put the __weak
qualifier in front of one of the variables. Of course in your example, if you make objectA
weak, then it will result in your object being deallocated immediately, so both of your pointers will remain nil
.