2 Matching Annotations
- Jun 2023
-
stackoverflow.com stackoverflow.com
-
Using a property or a method to access the field enables you to maintain encapsulation, and fulfill the contract of the declaring class.
-
Exposing properties gives you a way to hide the implementation. It also allows you to change the implementation without changing the code that uses it (e.g. if you decide to change the way data are stored in the class)
-