The keyword friend grants a nonmember function access to the private members of a class. To specify a friend function, include that function’s prototype in the public section of a class declaration and precede the entire prototype with the keyword friend. For example, in the following class, myfunc( ) is a friend, not a member, of myclass:

class myclass {   // ... public:   friend void myfunc(int a, float b);   // ... };

Keep in mind that a friend function does not have a this pointer because it is not a member of the class.

C(s)C++ Programmer's Reference
C Programming on the IBM PC (C Programmers Reference Guide Series)
ISBN: 0673462897
EAN: 2147483647
Year: 2002
Pages: 539 © 2008-2017.
If you may any questions please contact us: