<<< Friends make exceptions from access control rules | Index | >>> |
A friend gets full access to private members of the class.
Friendship is a one-way street:
Friendship is not symmetrical.
A class has no access to its friend.
The friend of my friend is still a stranger to me...
...friendship is not transitive.
Suggestions:
Prefer making functions friends rather than classes;
Declare friends at the top of class declarations;
Don't make friends lightly!
<<< Friends make exceptions from access control rules | Index | >>> |