1.

Pick the correct statement.(a) Friend functions are in the scope of a class(b) Friend functions can be called using class objects(c) Friend functions can be invoked as a normal function(d) Friend functions can access only protected members not the private membersThis question was addressed to me during an interview.My question is from Friend Function topic in division Source Files, Classes and Operator Overloading in C++ of C++

Answer»

The correct ANSWER is (C) Friend functions can be invoked as a normal function

To EXPLAIN I WOULD say: Friend functions are not in the scope of a CLASS and hence cannot be called through a class object. A friend function can access all types of members of the class. They can be invoked as a normal function.



Discussion

No Comment Found

Related InterviewSolutions