Basically getters and setters are just means of helping encapsulation . When you make a class you have several class variables that perhaps you want to expose to other classes to allow them to get a glimpse of some of the data you store.
Basically getters and setters are just means of helping encapsulation . When you make a class you have several class variables that perhaps you want to expose to other classes to allow them to get a glimpse of some of the data you store.