What is the difference between public, private, and protected?

When and why should I use public, private, and protected functions and variables inside a class? What is the difference between them? Outsider members cannot access those variables. “Outsiders” in the sense that they are not object instances of the declared class itself….

Source: http://stackoverflow.com/questions/4361553/what-is-the-difference-between-public-private-and-protected

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.