0

variables within a class private

why its not the rule?

19th Dec 2019, 1:25 PM
Lenyuk Michal
2 Antworten
+ 1
It is the rule. You must have heard about encapsulation, so exposing every variable of the class is not recommended because you do not want every user to alter the value of a program that you created. Edit: Need not be private at all times but it is a good practice.
19th Dec 2019, 1:37 PM
Avinesh
Avinesh - avatar