+ 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.

21st Dec 2017, 5:37 PM
Bo Yang
Bo Yang - avatar
2 Respostas
+ 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
27th Dec 2017, 7:51 AM
Muskan Bansal
Muskan Bansal - avatar
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.
22nd Dec 2017, 4:37 AM
Kevin Gilkey-Graham
Kevin Gilkey-Graham - avatar