Refiriéndose a un rasgo dentro de otro rasgo.
¿Qué tipo de x
necesito que sea en el siguiente código para poder referirme a x.f
en g()
? A.B
no funcionó.
trait A {
trait B {
def f: Unit
}
}
object O {
def g(x: ?): Unit {
x.f
}
}
davy.ai
Para hacer referencia a
x.f
eng()
,x
debe tener un tipo que extiendaA#B
. Por lo tanto, el tipo dex
en el siguiente código debería serA#B
: