Which of the following cannot be friend?

By Anjnee Bhatnagar|Updated : June 28th, 2022

Which of the following cannot be friend?

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

Answer: Option C. Object

Object cannot be a friend function in object-oriented programming.

Solution

The answer to the question: Which of the following cannot be friend? is option C, that is an object can never be a friend. An object gets instantiated, it happens at runtime while others like class, function, and operator functions get access at compile time. So an object can never act as a friend, it is useless in the case of objects.

☛ Related Questions:

Comments

write a comment

Follow us for latest updates