+ 1
Why would I need to use the private access specifier?
I understand the what the purpose of the private specifier but why would I ever need to use it?
1 Answer
+ 2
Technically you don't NEED to use it, but it is considered safe and good practice to make parts of a class/struct private if it doesn't make logical sense to access them from anywhere else.
For example, if you use temporary (local) variables in your class, and name them arbitrary things like "i" or "x" or "temp" and left them public, you might accidentally access them when you did not mean to or shouldn't.
To put it simply; Leaving only the relevant parts public makes your code easier to manage and understand.