trait A { fun foo(t: T): String } class Derived(a: A) : A by a fun box(): String { val o = object : A { override fun foo(t: Int) = if (t == 42) "OK" else "Fail $t" } return Derived(o).foo(42) }