I use private variables/methods pretty often to hide functionality that the user doesn't need to touch. However, for libraries that might be extended and need to access private variables, I provide an "expose" method that sets references to all private variables and methods in the current context. This might defeat the purpose of having private variables at all, but at the very least, it forces the person to have some idea what their doing before they can access them.
↧