5

What's a good hash function for overwriting NSObject's hash method in your custom classes?

cfischer
  • 24,452
  • 37
  • 131
  • 214
  • Why do you think you need to override `hash`? If you do, it is generally because you explicitly want to hash based on whatever data is stored in your object. – bbum May 07 '11 at 01:54

1 Answers1

7

Here is a good community wiki page discussing overwriting the functions Implementing -hash / -isEqual: / -isEqualTo...: for Objective-C collections.
And there is an implementation on one of the linked articles Best practices for overriding isEqual: and hash.

Community
  • 1
  • 1
mistagrooves
  • 2,337
  • 15
  • 16