December 1998
Intermediate to advanced
624 pages
13h 8m
English
![]()
A friend is an entity to which a class grants access authority.
Friends can be functions, other classes, or individual member functions of other classes. Friend classes are used when two or more classes are designed to work together and need access to each other's implementation in ways that the rest of the world shouldn't be allowed to have. In other words, they help keep private things private. For instance, it may be desirable for class DatabaseCursor to have more privilege to the internals of class Database than main() has.
In the early days of OO, people had all ...
Read now
Unlock full access