Q. Which of the following correctly describes a friend function in C++?

  • (A) A function that is a member of two different classes
  • (B) A function that can access private members of a class
  • (C) A function defined in multiple classes
  • (D) A function that can only be used with objects
πŸ’¬ Discuss
βœ… Correct Answer: (B) A function that can access private members of a class
Explanation: A friend function is not a member of a class but has access to its private and protected members.
Explanation by: Shiva Ram
A friend function is not a member of a class but has access to its private and protected members.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
190
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Shiva Ram
Publisher
πŸ“ˆ
99%
Success Rate