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 words friend and and/or friend:

    “Praise to Christ who feeds the hungry, frees the captive, finds the lost,
    Heals the sick, upsets religion, fearless both of fate and cost.
    Celebrate Christ’s constant presence—Friend and Stranger, Guest and Host.”
    —The Iona Community (founded 1938)

    “Until a friend or relative has applied a particular proverb to your own life, or until you’ve watched him apply the proverb to his own life, it has no power to sway you.”
    —Nicholson Baker (b. 1957)