hamburger

Which of the following cannot be friend?

By BYJU'S Exam Prep

Updated on: September 25th, 2023

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:

Our Apps Playstore
POPULAR EXAMS
SSC and Bank
Other Exams
GradeStack Learning Pvt. Ltd.Windsor IT Park, Tower - A, 2nd Floor, Sector 125, Noida, Uttar Pradesh 201303 help@byjusexamprep.com
Home Practice Test Series Premium