0
Why we want to create variables private in a class? It is not easy as public?
Please answer
2 Answers
+ 2
Would you like if you card number wasn't private in some class in ATM? That means somebody could very easily hack it and steal your money... Private is used to hide data from user(s) of program
+ 3
But then again, data marked private are actually public in memory, the computer doesn't care and you can still easily hack it. :)
private has nothing to do with security, it only prevents the programmer from messing things up too badly by disallowing direct access to the variables/functions.