bj0
06/22/2018, 11:17 PMclass SomeClass : ApiX by ApiXImpl(::send)
But the object doesn't exist yet so ::send
doesn't work. Is there a way to accomplish this or do I need to abandon class delegation and just manually wrap all the calls?gcx11
06/23/2018, 4:25 PMinterface Bar {
fun bar()
}
class BarImpl(val commonData: CommonData): Bar {
override fun bar() {
println("Calling bar: ${commonData.value}")
}
}
class CommonData(val value: Int)
class Foo(val commonData: CommonData): Bar by BarImpl(commonData)
fun main(args: Array<String>) {
val foo = Foo(CommonData(42))
foo.bar()
}