Access Modifiers


Any class can view public methods, variables, etc.


A Private method or variable is one that cannot be accessed by another class.


"One Class cannot touch another class's privates!"

Data Hiding

Private methods or variables are useful for storing data in a way that nobody else will be able to tell how we stored it. Then, if one was to change the data members in a private method or variable, it would have no effect on someone who is using that method or variable.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License