Kotlin - How can we access private property with getter and setter? Is access methods are calling internally? [duplicate]
问题 This question already has answers here : Getters and Setters in Kotlin (5 answers) Closed 2 years ago . class Sample1 { private var test = "" get() = field set(value) { field = value }} This is my class. I want to keep the property as private and have to access the property through getter and setter. var sample1 = Sample1() I tried to create an object and access the property, but fails. When I go through the docs, I could found one interesting thing, "Getters always have the same visibility