https://kotlinlang.org logo
s

squeezymo

10/11/2016, 8:01 PM
Hi there. Very basic question from a beginner here which I can't seem to google out. Say I have a property declared like this
Copy code
var myProperty = 0
    get() { return field + 1 }
    private set
How do I read the property directly from within my class?
Copy code
fun increment() {
    myProperty = myProperty + 1
    println("myProperty == $myProperty") //=> prints `myProperty == 3` instead of 2
}