Do you want BuboFlash to help you learning these things? Or do you want to add or correct something? Click here to log in or create user.



Tags
#odersky-programming-in-scala-2ed #scala
Question
How come an abstract method can call super? It would certainly fall for classes.

trait Doubling extends IntQueue {
  abstract override def put(x: Int) { super.put(2 * x) }
}
Answer
Since super calls in a trait are dynamically bound, the super call in trait Doubling will work so long as the trait is mixed in after another trait or class that gives a concrete definition to the method.

Tags
#odersky-programming-in-scala-2ed #scala
Question
How come an abstract method can call super? It would certainly fall for classes.

trait Doubling extends IntQueue {
  abstract override def put(x: Int) { super.put(2 * x) }
}
Answer
?

Tags
#odersky-programming-in-scala-2ed #scala
Question
How come an abstract method can call super? It would certainly fall for classes.

trait Doubling extends IntQueue {
  abstract override def put(x: Int) { super.put(2 * x) }
}
Answer
Since super calls in a trait are dynamically bound, the super call in trait Doubling will work so long as the trait is mixed in after another trait or class that gives a concrete definition to the method.
If you want to change selection, open document below and click on "Move attachment"

pdf

cannot see any pdfs

Summary

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Details

No repetitions


Discussion

Do you want to join discussion? Click here to log in or create user.