 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| • |
Remember
that with data hiding and encapsulation, we
|
|
|
force
clients to manipulate private data through public
|
|
|
member
functions. By declaring friends, we allow non-
|
|
|
member
functions or member functions of other classes
|
|
|
access
to private data.
|
|
| • |
A
class can declare another class to be a friend.
|
|
| • |
When
we do this, the first class gives all member
|
|
|
functions
of the second class permission to access all of its
|
|
protected
and private information (not the other way
|
|
|
around;
a class cannot declare itself a friend of another
|
|
|
class).
|
|