Thanks again for your explanation, and sorry but I have to ask again.
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
var myExample = Example()
myExample.myAmazingValue = "123" }
}
class Example {
private var myAmazingValue: String = ""
}
I have this coding. Now when I try to access myAmazingValue from outside the Example class, I get the message "Cannot access the ‘myAmazingValue’: it is private in ‘Example’. But there is also no getmyAmazingValue( ) method or anything that I could call. Above you said that even for private properties getter and setter methods are created and hidden. Are their visibility also private and thats why I can’t access them? If so, what is the point of those? From my understanding, getter and setter methods are for external access and not from within the class.
This confuses me. Iam coming from ABAP (SAP) and it is very common to have private/protected attributes with public get/set methods. When do you use public properties and when do you use private ones? Are there any security concerns? Or is it generally okay to leave most, if not all my properties public?
Sorry if I seem a little dumb, but developing in Kotlin is just sooo different from developing in ABAP