更新时间:2023-11-19 17:38:52
这在2.8和2.11中对我有效,并且允许您对特征A
或B
不打扰:
This works for me in 2.8 and 2.11, and would allow you to be non-intrusive in traits A
or B
:
trait A { def hi = println("A") }
trait B { def hi = println("B") }
class C extends A with B {
override def hi = super[B].hi
def howdy = super[A].hi // if you still want A#hi available
}
object App extends Application {
(new C).hi // prints "B"
}