In Scala no methods can be invoked on the current instance when the superclass constructor is called. So there is no opportunity for a method to be invoked which will memorise the value that it is returning, in the current instance. How can I retain the arguments produced to give to a superclass constructor, while still using inheritance, as opposed to composition, and without modifying the source code of the class I’m inheriting from?
Share
In Scala 2.8 and above, use an early definition:
This works even if
Baris a class rather than a trait.