Discussion :: OOPS Concepts - General Questions (Q.No.51)
|Ishu said: (Oct 1, 2012)|
|Friend function can only access the private data members of a class. Is this correct?|
|Manoj Kumar Sahoo said: (Jul 31, 2013)|
|Friend function can access all private, protected and public data members of a class. So option D is right.|
|Rajkumar said: (Sep 23, 2013)|
|Friend function can access protected and public members of both classes and it can also access private members by using object of that class.
plus(int i,int j)
friend plus operator+(plus ob1,plus ob2);
cout<<"x and y"<<x<<y;
plus operator+(plus ob1,plus ob2)
|Nilofer said: (Oct 3, 2013)|
|Friend function can access private members of class.|
|Prisci said: (Oct 10, 2013)|
|What is friend function?|
|Ghost In Oops said: (Oct 22, 2013)|
|Friend function is one which is used to access the private data of a class for which it is defined. It can also used to access protected and public data of a class for which it is defined as a friend.|
|Renuka said: (Feb 23, 2017)|
|Friend function is a non-member function, to access the data within a class as well as out side the class. It can also use private and public member of class.|
|Hatos said: (Mar 2, 2018)|
|Why do we need "friend"?
If a public function can be accessed from the outside?
|Akshit Mittal said: (Nov 18, 2018)|
|According to me, friend function can access private data of the class.|
Post your comments here:
Email : (optional)
» Your comments will be displayed only after manual approval.