Glossary: Friend

The power of OO comes from the twin concepts of a simple interface (abstraction) with all implementation details hidden (encapsulation). However, sometimes one class. say Class B, cooperates so closely with another, say Class A, that it has to know more about than the OO model dictates. In this situation class A can declare that Class B is a friend which gives it the same access as if it were part of A. As in life, friendship is not necessarily reciprocal, A has not special access to B, unless B chooses to declare A as a friend as well.
See OO Concepts: Private & Public
Go Back to the The Glossary Top Page


If you have any comments about this page please send them to Nick West