How to make the subclass arguments available in the abstract class for pattern matching in scala?
I have a class and two case subclasses: abstract class C case class C1(left: C, right: C, weight: Int) extends C case class C2(weight: Int) extends C I want to implement something like the following: def weight(t: C): Int = { t match { case c1: C1 => l.weight case c2: C2 => c2.left.weight +… Read More How to make the subclass arguments available in the abstract class for pattern matching in scala?