I\'m designing a class hierarchy, which consists of a base class along with several traits. The base class provides default implementations of several methods, and the trai
This isn't possible.
But you can use implicitly and Scala's type inference to make this as painless as possible.
trait MyTrait {
protected[this] implicit def e: ClassName
}
and then
class MyClass extends MyTrait {
protected[this] val e = implicitly // or def
}
Succinct, and doesn't even require writing the type in the extending class.