https://kotlinlang.org logo
Title
u

user

07/24/2022, 7:41 PM
Why is the no lateinit block in Kotlin? The following code is valid Kotlin code: abstract class A { protected lateinit var v: X abstract fun f(): X class SubA : A() { override fun f(): X { return SubX() } init { v = f() } } } It defines an abstract class which has a lateinit var field and an abstract method that sets the value of that field. The reason behind this is that that method may be called later again, and its behavior should be defined in the...