Friend Class - Friend and Encapsulation

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:

    “You the one, I the few”
    said John Adams
    speaking of fears in the abstract
    to his volatile friend Mr. Jefferson,
    Ezra Pound (1885–1972)