I am experimenting with multiple inheritance in Scala. I understand that there is permission from right to left, but I do not understand the role of the keyword override. Consider the following snippet:
trait A { def method }
class B extends A { def method = println("B") }
trait C extends A { override def method = println("C") }
trait E { }
class D extends B with C with E
It compiles fine, but if I remove overridefrom the right-most attribute that defines method, it will be broken. Why is this? Is the method overridden even without a keyword?
source
share