Your Ad Here

Wednesday, October 8, 2008

Functions are Public, Data is Private

Usually the data within a class is private and the functions are public. This is a result of how classes are used. The data is hidden so it will be safe from accidental manipulation, while the functions that operate on the data are public so they can be accessed from outside the class. However, there is no rule that data must be private and functions public; in some circumstances you may find you’ll need to use private functions and public data.

No comments: