friend keyword

suggest change

Well-designed classes encapsulate their functionality, hiding their implementation while providing a clean, documented interface. This allows redesign or change so long as the interface is unchanged.

In a more complex scenario, multiple classes that rely on each others’ implementation details may be required. Friend classes and functions allow these peers access to each others’ details, without compromising the encapsulation and information hiding of the documented interface.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents