accessors are generally used to encapsulate and control access behavior.
take the above picture as an example. For example, if you need to control the age at least 18 years old, you can decide not to save it in set if you are younger than 18 years old.
Acceesor
mechanism, some MVVM frameworks use responsive
getter
and setter
.
one of the implementation principles of the mvvm framework: data hijacking is done with get set.