Why use getters and setters/accessors?

There are actually many good reasons to consider using accessors rather than directly exposing fields of a class – beyond just the argument of encapsulation and making future changes easier. Here are the some of the reasons I am aware of: Encapsulation of behavior associated with getting or setting the property – this allows additional functionality (like validation) … Read more