Friend and Encapsulation
It is said that friend classes violate encapsulation as it has an access to internals of the class in which it is declared. A friend allows a class a by hiding details that may be needed by anything but the friends of the class. It is also said that friend classes can also enhance encapsulation as it allows library writers to write an interface which is not compromised in order to allow proper internal referencing.
Read more about this topic: Friend Class
Famous quotes containing the word friend:
“It may be said that the elegant Swanns simplicity was but another, more refined form of vanity and that, like other Israelites, my parents old friend could present, one by one, the succession of states through which had passed his race, from the most naive snobbishness to the worst coarseness to the finest politeness.”
—Marcel Proust (18711922)