I don’t understand, why this code doesn’t compile with message Property must be initialized or be abstract:
interface A {
var num: Int
}
class AImpl : A {
override var num: Int
init {
// some calculations
num = 123
}
}
The same code works if num is declared as val, or if num is initialized in assignment. I can create some factory method or initialize it with kotlin.run { }, but both options are quite ugly. So why this code cannot be compiled?