Wednesday, March 30, 2011

What is Friend Function in C++?

A non_member function that is allowed access to the private variable f a class is called a FRIEND of the class.

Features of the friend function


1. A friend function can access the private member of a class.

2. Friend functions need not have a "this" pointer, as it does not belong to any object.

3. The friend declaration is unaffected by its location in the class.

4. the definition of a friend function does not require the class name with the scope resolution operator prefixed to it, as it is required for a class member function.


Unix Shell Programming




Let Us C

No comments:

Post a Comment