C++ Friend Question:

Download Job Interview Questions and Answers PDF

What is the friend class in C++?

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

Answer:

When a class declares another class as its friend, it is giving complete access to all its data and methods including private and protected data and methods to the friend class member methods. Friendship is one way only, which means if A declares B as its friend it does NOT mean that A can access private data of B. It only means that B can access all data of A.

Download C++ Friend Interview Questions And Answers PDF

Previous QuestionNext Question
Pick out the correct statement.
a) A friend function may be a member of another class.
b) A friend function may not be a member of another class.
c) A friend function may or may not be a member of another class.
d) None of the mentioned
List the characteristics of friend functions?