konsoletyper
11/02/2016, 8:02 AMabstract class A {
init {
println("A.init: " + bar())
}
abstract fun foo(): String
fun bar() = foo()
}
class C : A() {
private val result = "OK"
override fun foo() = result
}
fun main(args: Array<String>) {
println("main: " + C().bar())
}
This code reproduces the problem. Its output is
A.init: undefined
main: OK
The same behaviour in JVM, except for uninitialized value for result property is null instead of undefined