1.

What is the syntax of friend function?(a) friend class1 Class2;(b) friend class;(c) friend class(d) friend class()The question was asked in an online quiz.My query is from Friends in section Source Files, Classes and Operator Overloading in C++ of C++

Answer»

Correct answer is (a) FRIEND class1 CLASS2;

The BEST explanation: In option a, the class2 is the friend of class1 and it can ACCESS all the PRIVATE and protected members of class1.



Discussion

No Comment Found

Related InterviewSolutions