我有以下内容:
abstract class Super(val m0: Member) {
def toJson: JsValue = Json.toJson(Map(("m0", m0.toJson)))
}
class Sub(m0: Member, m1: Member) extends Super(m0) {
def toJson: JsValue = ??? // should use super.toJson
}
如何定义 Sub.toJson 以便它可以重用 Super.toJson 并产生:
// assuming m0.toJson is "member0" and m1.toJson is "member1"
{
"m0": "member0",
"m1": "member1"
}