In C++, if a class makes a non-member function its friend, that function gets the ability to access the _______ and _______ members of the class. 

  • public, private 
  • private, protected 
  • public, static 
  • static, protected
In C++, when a non-member function is declared as a friend of a class, it can access both private and protected members of that class. Public members are accessible to all functions, so the unique ability granted by the friendship is access to the private and protected members.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *