I read the section of Programming in Scala where abstract override
is introduced, but I'm still confused by what exactly is signified by the joining of these modifiers. The snippet of code in which these modifiers is used is pasted below:
trait Doubling extends IntQueue {
abstract override def put(x: Int) { super.put(2 * x) }
}
In particular, I am confused by the purpose of abstract
in this case, and why we cannot achieve the expected results simply with the override
keyword. If we did not include a call to super
, would we need the keyword abstract
? Why or why not? I'm looking for a detailed explanation of this keyword combo as it pertains to stackable traits.