Why are getters and setters important?


#1

Question

Why are getters and setters important?

Answer

Getters and setters are important to use when we want to perform some operation on data before we view or save said data. Getters and setters are also important to use when we want to make sure we don’t override data unintentionally, by making that data accessible only through our getters and setters