Andrew
01/23/2021, 6:01 AMColton Idle
01/23/2021, 7:02 AMjbnizet
01/23/2021, 7:08 AMEl Zhang
01/23/2021, 7:44 AMopen class A {
fun method1() {
println("A: method1")
}
fun method2() {
println("A: method2")
}
}
interface B {
fun method2()
}
class C: A(), B
fun main() {
val b: B = C()
b.method2()
}
With this pattern you can even specify method2
as from BRob Elliot
01/23/2021, 12:58 PMclass CannotBeChanged {
fun someMethod() {}
}
interface NewInterface {
fun someMethod()
}
class MyClass(delegate: CannotBeChanged) : NewInterface by delegate
In principal it could observe that CannotBeChanged
meets all the requirements to implement NewInterface
and so could be used as the delegate to do so in MyClass
.Nir
01/23/2021, 1:44 PMAndrew
01/23/2021, 4:33 PMHans Ellegard
01/25/2021, 10:01 AM