title: How to override equality method in Smalltalk?
body: <p>I'm reading a <a href="http://books.google.ro/books/about/Smalltalk_Objects_and_Design.html?id=W8_Une9cbbgC&amp;redir_esc=y" rel="nofollow">book on Smalltalk</a> and I have an exercise about the <em>anomaly of disappearing element</em> I'm not able to solve.</p>
  
  <pre><code>Object subclass: Book [
      | isbn |
      &lt;comment: 'A book class'&gt;
  
      setIsbn: anIsbn [
          isbn := anIsbn.
      ]
  
      getIsbn [
          ^isbn.
      ]
  
      = anotherBook [
          ^self getIsbn = anotherBook getIsbn.
      ]
  ]
  
  | Library |
  
  Library := Set new: 100.
  Library add: (Book new setIsbn: '0-671-2-158-1').
  (Library includes: (Book new setIsbn: '0-671-2-158-1')) printNl.
  </code></pre>
  
  <p>I read I have to override the <code>hash</code> method too, but I don't know how to do it. How do I amend the <code>Book</code> class in order to avoid the <em>anomaly</em>?</p>