C++ Friend Question:
Download Questions PDF

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

Answer:

a) private and protected members of a class cannot be accessed from outside
Explanation:
Friend is used to access private and protected members of a class from outside the same class.

Download C++ Friend Interview Questions And Answers PDF

Previous QuestionNext Question
What are the advantages of using friend classes?What is the syntax of friend function?
a) friend class1 Class2;
b) friend class;
c) friend class
d) None of the mentioned