What Is Friend Function in C++ ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Shubham Kumar
    Junior Member
    • Aug 2016
    • 16

    What Is Friend Function in C++ ?

    On which condition we can use it ?
  • priya.sharma
    Senior Member
    • Aug 2016
    • 105

    #2
    A friend function of a cl*** is defined outside that cl***' scope but it has the right to access all private and protected members of the cl***. Even though the prototypes for friend functions appear in the cl*** definition, friends are not member functions.

    Also A friend can be a function, function template, or member function, or a cl*** or cl*** template, in which case the entire cl*** and all of its members are friends

    Comment

    Working...
    😀
    😂
    🥰
    😘
    🤢
    😎
    😞
    😡
    👍
    👎