+ 2
It is good code practice to set variables in a class as private so they can only be accessed and modified within that class. Getters and setters are a way for you to access and modify those variables outside their class while they remain private variables.
21st Sep 2016, 2:29 PM
Alex Wood
Alex Wood - avatar