How to avoid scala's case class default toString function being overridden?

后端 未结 3 1865
Happy的楠姐
Happy的楠姐 2020-12-16 17:05

Scala case class has a default toString function. But when this case class extends a trait with an existing toString() function, it will be rendered useless. How can I preve

3条回答
  •  失恋的感觉
    2020-12-16 17:20

    OK here is the easist answer:

    override def toString = ScalaRunTime._toString(this)
    

    end of story:)

提交回复
热议问题