+ 1
Are there only two accessors for one property (get and set) in C#? How about in C++ or Java?
lt looks like property gives a shortcut for data validation, which can still be realized by regular methods.
2 Respuestas
+ 1
These are getter and setter functions can be used in java. But it is not a good programming practice. It is used for data hidding
0
Safe code is usually designed so the variables in a class are never accessible from outside the class. There are some exceptions but usually you would have a method that would either set or get the value or have one method to do both but only for the variable you want to be altered or accessed. I'm not sure if this is answering your question since I couldn't really tell what your question was.