0
What is the setter and getter function
What is the setter and getter function
2 ответов
+ 3
When you have a class, it's best to protect the members of it, and you can do that via encapsulation. This allows you to keep the members private and then use the getter/setter functions of the class to get the values and/or set them.
As the names imply, getters are used to GET the value from a private member and setters are used to SET the value of a private member of an object.
0
Thanks AgentSmith