1.

What is a friend function in C++?(a) A function which can access all the private, protected and public members of a class(b) A function which is not allowed to access any member of any class(c) A function which is allowed to access public and protected members of a class(d) A function which is allowed to access only public members of a class

Answer» The correct answer is (a) A function which can access all the private, protected and public members of a class

To explain I would say: Friend function in C++ is a function which can access all the private, protected and public members of a class.


Discussion

No Comment Found

Related InterviewSolutions