+ 1
What is Kotlin delegation and how it works?
I'm really confused by Kotlin delegation, can somebody provide me with a more practical example? interface Base { fun print() } class BaseImpl(val x: Int) : Base { override fun print() { print(x) } } class Derived(b: Base) : Base by b fun main() { val b = BaseImpl(10) Derived(b).print() }
2 odpowiedzi