Get and set
In order to allow controlled access to properties from outside the class, getter and setter methods are used.
A getter method allows reading a property’s value.
A setter method allows modifying a property’s value.
It is a common convention to write the name of the corresponding member fields with the get or set command.
Example
Let’s write get and set methods for __username in our User class.