Friend Function : Like a friend class , friend function can be access the grant to access the private and protected data member . It is same as a friend function .
a ) A member of another class
b) A global function
In a program , we are all know that we can't access the private and protected data member so in c++ friend function is a type of function which can access the private and protected data member and the friend function make the outside the class . But friend function is not same as inheritance .
Example of Friend Classes
Output :
A::a=0
Output :
A::a=0
Please write comment if you find anything incorrect in the above information .
This article is contributed by Mohd Abuzar . If you like code with abuzar or want to share more information about this topic so you will be mail at abuzar.abuzar.mohd325@gmail.com
0 Comments
Do not Comment and any spam text