OOPS
August 29, 2024OOPS
August 29, 2024OOPS
|
Question 191
|
Which of the following is not a member of class ?
|
Static function
|
|
|
Friend function
|
|
|
Const function
|
|
|
Virtual function
|
Question 191 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: B
Question 191 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.
