0
Getter and setter , how to use ? What is the need ?
getter and setter
2 Answers
+ 1
In OOP it is a common way to capsule data.
It's usual to declare the properties of an object as private. So you haven't acces to this datatypes, so you use set and get functions to get public acces to the datatypes.
You do this with functions, because you can modify the result/output with parameters.
They are much more I can say, but it's better to inform you in the internet.