case class a(i:Int)
{
override def canEqual(a: Any) = a.isInstanceOf[a]
override def equals(o:Any) = AnyRef.equals(o)
override def hashCode = AnyRef.hashCode
}
val aa = new a(1)
aa == aa //false
Am I right? )
val AnyRef = new Specializable {
override def toString = "object AnyRef"
}
--
You received this message because you are subscribed to the Google Groups "scala-language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-language+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I found that subj returns false for the same object. It is a terrible mistake for me
case class a(i:Int)
{
override def canEqual(a: Any) = a.isInstanceOf[Int]
override def equals(o:Any) = AnyRef.equals(o)
override def hashCode = AnyRef.hashCode
}
val aa = new a(1)
aa == aa //false
Am I right? )
--
You received this message because you are subscribed to the Google Groups "scala-language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-language+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to scala-languag...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--