Take the 2-minute tour ×  While looking for something else,
quite out of mere coincidence I stumbled upon few comments about
how diabolical case class inheritance is. There was this thing
called ProductN , wretches and kings, elves and wizards and how
some kind of a very desirable property is lost with case classes
inheritance. So what is so wrong with case class inheritance ?
share|improve this question add comment  1 Answer  One word:
equality  case classes come with a supplied implementation of
equals and hashCode. The equivalence relation, known as equals
works like this (i.e. must have the following properties):    1.
For all x; x equals x is true (reflexive)   2. For x, y, z; if x
equals y and y equals z then x equals z (transitive)   3. For x,
y; if x equals y then y equals x (symmetric)  As soon as you
allow for equality within an inheritance hierarchy you can break
2 and 3. this is trivially demonstrated by the following
example:  case class Point(x: Int, y: Int) case class
ColoredPoint(x: Int, y: I