Which of the following cannot be friend?
By BYJU'S Exam Prep
Updated on: September 25th, 2023
Which of the following cannot be friend?
- Function
- Class
- Object
- 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: