What is the difference between getters and setters while coding? How do you choose between getData and setData while working?
Explain this within 150-200 words
What is the difference between getters and setters while coding? How do you choose between getData and setData while working?
Explain this within 150-200 words
Getters and Setters are different ways of what a function does. As the names suggest a getter function retrieves data to perform for example the correct display of our map. A setter function sets the data to be later accessed. When a property is set, it implicitly calls a function and the value is passed as an argument. With that, the return value is set to the property itself.