Given:
case class FirstCC {
def name: String = ... // something that will give \"FirstCC\"
}
case class SecondCC extends FirstCC
val one = FirstCC()
val two =
You can use the property productPrefix of the case class:
case class FirstCC {
def name = productPrefix
}
case class SecondCC extends FirstCC
val one = FirstCC()
val two = SecondCC()
one.name
two.name
N.B.
If you pass to scala 2.8 extending a case class have been deprecated, and you have to not forget the left and right parent ()