The following code will give a compilation error that says “inheritance in case of failure”.
case class BaseEvent(eventType: String, payload: Map[String, Any] = Map())
case class ChildEvent(payload: Map[String, Any] = Map()) extends BaseEvent("ChildEventType", payload)
I understand that I can change a BaseEvent to a regular class or trait to compile it. But I would still like to understand why Scala does not allow case inheritance. For example.
source
share