...
Computer-Networks
October 18, 2023
NVS PGT CS 2017 Part-B
October 18, 2023
Computer-Networks
October 18, 2023
NVS PGT CS 2017 Part-B
October 18, 2023

OOPS

Question 35
If a function is friend of a class, which one of the following is wrong?
A
A function can only be declared a friend by a class itself.
B
Friend functions are not members of a class, they are associated with it.
C
Friend functions are members of a class.
D
It can have access to all members of the class, even private ones.
Question 35 Explanation: 
→ A friend function of a class is defined outside that class’ scope but it has the right to access all private and protected members of the class. Even though the prototypes for friend functions
appear in the class definition, friends are not member functions.
TRUE: function can only be declared a friend by a class itself.
TRUE: Friend functions are not members of a class, they are associated with it.
FALSE:Friend functions are members of a class.
TRUE: It can have access to all members of the class, even private ones.
Correct Answer: C
Question 35 Explanation: 
→ A friend function of a class is defined outside that class’ scope but it has the right to access all private and protected members of the class. Even though the prototypes for friend functions
appear in the class definition, friends are not member functions.
TRUE: function can only be declared a friend by a class itself.
TRUE: Friend functions are not members of a class, they are associated with it.
FALSE:Friend functions are members of a class.
TRUE: It can have access to all members of the class, even private ones.
0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!