The ==
operator tests whether the two expressions are the same pointer to the same object. Cocoa calls this relation “identical” (see, for example, NSArray's indexOfObjectIdenticalTo:
).
To test whether two objects are equal, you would send one of them an isEqual:
message (or a more specific message, such as isEqualToString:
, if it responds to one), passing the other object. This would return YES
if you really only have one object (equal to itself, obviously) or if you have two objects that are equal. In the latter case, ==
will evaluate to NO
.