inaction
01/17/2017, 9:24 AMclass People(n: String) {
val name = n
}
class Test {
var me: People? = null
fun initial() {
me = People("Inaction")
}
fun hi(name: String) {
println(name)
}
fun doSomething() {
initial()
me?.let {
hi(me.name)
}
}
}
fun main(args: Array<String>) {
Test().doSomething()
}
Check the codes in doSomething
function, and I got the error:
Smart cast to 'People' is impossible, because 'me' is a mutable property that could have been changed by this time
So what should I do to solve this error?