Re: Differences between -isEqual: and -isEqualTo:?
Re: Differences between -isEqual: and -isEqualTo:?
- Subject: Re: Differences between -isEqual: and -isEqualTo:?
- From: "Shawn Erickson" <email@hidden>
- Date: Thu, 18 Sep 2008 16:32:01 -0700
On Thu, Sep 18, 2008 at 4:19 PM, Keith Duncan <email@hidden> wrote:
>> if two objects compare equal, then they must have the same hash [...]
>> [you] have to implement a corresponding -hash that maintains this invariant
>> rule.
>
> Is there an example somewhere of what one should do to implement -hash to
> reflect -isEqual:, I haven't done so in one of my classes and it works fine.
> Would you just combine the -hash of the objects used to determine -isEqual:
> in a logical manner, say XOR?
The only requirement is that if [objectA isEqual:objectB] returns true
then [objectA hash] == [objectB hash] must be true as well.
-Shawn
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden