For instance, in the following code:
class Animal
class Dog extends Animal
trait Base {
def a: Animal = new Dog
}
trait Deri extends Base {
override val a: Dog
}
The following error is given:
error: overriding value a in trait Deri of type Dog; method a in trait Base of type => Animal needs to be a stable, immutable value; (Note that value a in trait Deri of type Dog is abstract, and is therefore overridden by concrete method a in trait Base of type => Animal)
I want to know, since I have explicitly modified a
in Deri
with override
, while does Scala choose to do the other way around(overriding a
in Deri
with that in Base
as indicated in error msg)?