Consider: ``` interface PrintSomething { fu...
# announcements
k
Consider:
Copy code
interface PrintSomething {
    fun printSomething()
  }

  class PrintSomethingImpl(val print: String): PrintSomething {
    override fun printSomething() {
      println(print)
    }
  }

  class PrintClassName(val obj: IsNotFineDelegate): PrintSomething {
    override fun printSomething() {
      println(obj.javaClass.name)
    }
  }

  class IsFineDelegate(): PrintSomething by PrintSomethingImpl("this is fine") {
    init {
      printSomething() // Will print "this is fine" when the class is initialized
    }
  }

  class IsNotFineDelegate(): PrintSomething by PrintClassName(this) {
    init {
      printSomething() // If this compiled, we give access to this object to another class when it isn't fully initialized.
    }
  }