In the code below, if I print DDD().hey() I'll see the inside '9' then the output of 1. Read somewhere that's because BBB was the last trait mixed in.
Is three a way to control this vs convention? For example what if I want to force CCC's hey() to happen instead of BBB's (without just swapping the mixin orderings)?
trait AAA {
def hey(): Int
}
trait BBB extends AAA {
override def hey(): Int = 1
}
trait CCC extends AAA {
override def hey(): Int = 5
}
case class DDD() extends CCC with BBB {
override def hey(): Int = 9
def test(): Int = {
println("Inside: "+hey())
super.hey() // Can I control what 'super' means? BBB or CCC?
}
}