title: How to create equals methods for multiple classes which are dependent upon each other
body: <p>I seem to have run into a bit of a snag. I have 3 classes which need overridden equals methods. However, as I currently understand their class structure, this is not possible. I'm looking for some guidance on the matter.</p>
  
  <p>I have class A, inside of which is class B. Class A "has-a" class B.</p>
  
  <p>I have class B, inside of which is class C. Class B "has-a" class C.</p>
  
  <p>I have class C, inside of which is class A. Class C "has-a" class A.</p>
  
  <p>How does one correctly define an equals method, when seemingly each equals method is dependent upon another? Should I restructure the class relationships, or can I define an equals method given this relation?</p>
  
  <p>Thanks!</p>
  
  <p>EDIT: To further clarify, here's some more info on the classes (this isn't what they actually are, but a better understanding of why this relationship is so):</p>
  
  <p>Class A is a box.
  Class B is a smaller box.
  Class C is an object.</p>
  
  <p>Each A has a B.
  Each B has several Cs.
  Each C needs to know not only its B, but its A; therefore it takes as a field an A, giving us this circular relationship.</p>