Which of the following cannot be friend?

By Priyanshu Vaish|Updated : July 6th, 2022

Which of the following cannot be friend?

  1. Function
  2. Class
  3. Object or instance
  4. Operator function

Answer

C. Object or instance

Solution

A friend function is a function that participates in the class to pass arguments but is not a class member. Similarly, the object cannot be the friend because it is the instance of the class, but the class can be a friend.

The concept of operator overloading and type conversion makes use of the operator functions. The operator can be overloaded as a friend or member function. Hence, a friend function can be an operator function.

Comments

write a comment

Follow us for latest updates