raulraja
10/14/2020, 10:30 AMs should not have compiled or become accessible.dmitriy.novozhilov
10/14/2020, 10:37 AMdmitriy.novozhilov
10/14/2020, 10:39 AMdmitriy.novozhilov
10/14/2020, 10:42 AMclass A {
val x: String
init {
printX()
x = ""
}
fun printX() {
println(x.length)
}
}
fun main() {
A()
}dmitriy.novozhilov
10/14/2020, 10:44 AMval x: String = y
val y: String
get() = x
fun main() {
println(x.length)
}kralli
10/14/2020, 1:16 PMs twice in you example. c is referencing the top-level s , not the s in the constructor of A .
class A(val s: String) {
object B {
val c: String = d
}
}
val d: String = A.B.c
fun main() {
println(d) //s is null
}raulraja
10/14/2020, 1:56 PMraulraja
10/14/2020, 1:57 PM