Introduction
Getter and setter methods let you safely read and change values inside an object. They help keep data correct and private.
When you want to control how a value is read or changed in an object.
When you want to check or change data before saving it.
When you want to hide the details of how data is stored inside an object.
When you want to add extra actions when a value changes, like updating another value.
When you want to prevent direct access to important data to avoid mistakes.