10/10/2017, 6:29 PM
Hi Kotlin heads! Is there a way to use delegation with the "by" keyword with a class member that is not passed to the constructor, but initialized in the class body? I want to achieve something like that (this does not compile):
Copy code
interface Base {
    fun print()

class BaseImpl(val x: Int) : Base {
    override fun print() { print(x) }

class Derived() : Base by b {
    val b = BaseImpl(2)