A friend function of a class can:
-
A
only access its public data members
-
B
replace the class constructor entirely
-
C
access its private and protected members
Correct answer
-
D
inherit publicly from its base class
Correct answer
C. access its private and protected members
12 views
Explanation
The friend declaration grants a non-member function access to private and protected members.
Reference
Asked in: NTS, PPSC IT, Campus Interviews
Doubts & discussion
Not sure why the answer is C? Ask here and get an explanation.
Ask a doubt about this MCQ