<In Kotlin, does the presence of a custom setter a...
# stackoverflow
r
In Kotlin, does the presence of a custom setter affect the necessity of initializing a var property? class Student (private val age: Int){ var isAdultA get() = this.age >= 20 set(value) {} var isAdultB // "Property must be initialized" get() = this.age >= 20 } Hello, I've encountered a situation where isAdultA compiles without any issues, but isAdultB gives an "Property must be initialized" error message. While I'm aware that isAdultB hasn't explicitly defined a setter, I understand that a default setter is automatically generated. What fundamentally sets...