1. Home
  2. Computer Science MCQs
  3. C++ and Object-Oriented Programming
  4. A friend function of a class can:

Added 30 Nov -0001

A friend function of a class can:

  1. only access its public data members
  2. replace the class constructor entirely
  3. access its private and protected members Correct answer
  4. inherit publicly from its base class

Correct answer

C. access its private and protected members

12 views

MCQSEXAM

Explanation

The friend declaration grants a non-member function access to private and protected members.

Reference

Asked in: NTS, PPSC IT, Campus Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is C? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More C++ and Object-Oriented Programming MCQs

Practise all C++ and Object-Oriented Programming MCQs

Similar MCQs