Given:
abstract class A { def show: Unit }
trait T extends A {
abstract override def show: Unit = {
print(" T"); super.show; print(" xT")
}
}
trait U extends A {
abstract override def show: Unit = {
print(" U"); super.show; print(" xU")
}
}
class C extends A {
def show: Unit = print(" C")
}
I can do:
new C with T with U show
But, it "feels" (given Scala's propensity for shortened syntaxes and anonymous stuff in general) like I might be able to instantiate my mixed in class from an anonymous form. Something on the lines of
// doesn't work like this at least:
val a = new { def show { print("Anon")}} with T with U
a show
But I have entirely failed to determine if I'm simply using the wrong syntax, or if this is simply not possible. Can someone tell me how this should be done, or if it definitely is not possible?