【发布时间】:2016-04-27 15:22:18
【问题描述】:
我有两个特点
trait Base[A]
trait SometimesUsedWithBase[A] {
this: Base[A] =>
}
然后我将它们与类一起使用
class StringThing extends Base[String] with SometimesUsedWithBase[String]
如果我不必定义 SometimesUsedWithBase 的类型,那就太好了,而是它以某种方式理解它正在使用 Base 中定义的类型,因此它看起来像:
class StringThing extends Base[String] with SometimesUsedWithBase
这可能吗?
【问题讨论】: