OOPS
August 29, 2024OOPS
August 29, 2024OOPS
Question 206
|
The friend functions are used in situations where :
We want to have access to unrelated classes
|
|
Dynamic binding is required
|
|
Exchange of data between classes to take place
|
|
None of the above
|
Question 206 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.
1. A function can only be declared a friend by a class itself.
2. It can have access to all members of the class, even private ones.
1. A function can only be declared a friend by a class itself.
2. It can have access to all members of the class, even private ones.
Correct Answer: A
Question 206 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.
1. A function can only be declared a friend by a class itself.
2. It can have access to all members of the class, even private ones.
1. A function can only be declared a friend by a class itself.
2. It can have access to all members of the class, even private ones.
Subscribe
Login
0 Comments