Thursday, July 9, 2009

C++ help ?

What does private mean in C++?

C++ help ?
Specifying that a data member or member function is private means that it can only be accessed from within the class.





For data members/variables, this means that the data can be accessed or modified only while inside a member function of the class.





For member functions, this means that the function can be called only while inside another member function of the class.
Reply:The previous response is correct, except that a class may grant special access to its private members and functions by using the keyword 'friend'. It can make other classes friends, or static functions friends. http://www.parashift.com/c++-faq-lite/fr...


No comments:

Post a Comment