Re: Wisdom of overriding isEqual:
Re: Wisdom of overriding isEqual:
- Subject: Re: Wisdom of overriding isEqual:
- From: Wade Tregaskis <email@hidden>
- Date: Thu, 11 Mar 2004 10:26:03 +1100
2) No standard Cocoa class overrides isEqual:, at least the
documentation is
silent on this.
Lots of classes override isEqual. NSString for example.
Where and how? There is no mention of this in the documentation of
NSString.
NSString provides isEqualToString:, but that is not an override of
course.
And doesn't get called by NSSet et al. (at all)
As I understand it, NSString's isEqualToString: method bypasses type
checking and accesses the internal data of the other string directly,
for extra performance in situations where your design guarantees the
two objects really are strings. As the documentation says, you should
always use it where safe.
NSString's isEqual, as I understand it, just performs the type checking
and, if the argument is indeed another NSString, then calls
isEqualToString. Otherwise it returns NO (since if the argument is an
NSString, it can't be equal to the receiver, obviously).
Wade Tregaskis
-- Sed quis custodiet ipsos custodes?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.