C++ Friend Question:
Download Questions PDF

What is the syntax of friend function?
a) friend class1 Class2;
b) friend class;
c) friend class
d) None of the mentioned

C++ Friend Interview Question
C++ Friend Interview Question

Answer:

a) friend class1 Class2;
Explanation:
In option a, the class2 is the friend of class1 and it can access all the private and protected members of class1.

Download C++ Friend Interview Questions And Answers PDF

Previous QuestionNext Question
Which rule will not affect the friend function?
a) private and protected members of a class cannot be accessed from outside
b) private and protected member can be accessed anywhere
c) both a & b
d) None of the mentioned
Which keyword is used to declare the friend function?
a) firend
b) friend
c) classfriend
d) myfriend