previous | start | next

Friend Functions

C++ provides an alternative: friend functions of a class.

A friend function is a non-member function that is declared inside a class with the friend qualifier.

The friend qualifier tells the compiler this is not a member function of Pair, but if one of its parameters is of type Pair, then the friend function can access the private members of that Pair.



previous | start | next