adams2
12/07/2017, 7:10 PMadam-mcneilly
12/07/2017, 7:18 PMclass Test(value: Int) {
var myValue: Int = value
set(value) {
println("Setting value $value")
field = value
}
}
fun main(args: Array<String>) {
val test = Test(1)
test.myValue = 2
}
This will only print out "2". You'll never see the 1 (initial value) printed.