Friend Function

--Ashwiniiit (talk) 17:25, 7 February 2013 (UTC)

In object-oriented programming, a friend function that is a "friend" of a given class is allowed access to public, private, or protected data in that class. Normally, a function that is defined outside of a class cannot access such information. Declaring a function a friend of a class allows this, in languages where the concept is supported.

A friend function is declared by the class that is granting access. Friend declaration can be placed anywhere in the class declaration. It is not affected by the access control keywords.

A similar concept is that of friend class. Done Editing By FB.Com Friends should be used with caution. Too many functions or external classes declared as friends of a class with protected or private data may lessen the value of encapsulation of separate classes in object-oriented programming and may indicate a problem in the overall architecture design.

Read more about Friend Function:  Use Cases

Famous quotes containing the words friend and/or function:

    Some friends play at friendship but a true friend sticks closer than one’s nearest kin.
    Bible: Hebrew, Proverbs 18:24.

    Of all the inhabitants of the inferno, none but Lucifer knows that hell is hell, and the secret function of purgatory is to make of heaven an effective reality.
    Arnold Bennett (1867–1931)