S

Shiva Ram • 30.44K Points
Instructor I

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
  • Correct Answer - Option(B)
  • Views: 53
  • Filed under category C++

Explanation by: Shiva Ram
A friend function is not a member of a class but has access to its private and protected members.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.


Question analytics