recategorized
6,522 views

2 Answers

2 votes
2 votes

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. A friend can be a function, function template, or member function, or a class or class template, in which case the entire class and all of its members are friends.

Hence,Option(B)Friend Function.

Reference:-http://www.tutorialspoint.com/cplusplus/cpp_friend_functions.htm

0 votes
0 votes
In a class, the private data can be accessed only by the public member function of that class. c++ provides a mechanism in which a non member can have access to the private member of a class. This is achieved by the non_member function "friend" to the class, whose private data can be accessed.
Answer:

Related questions

0 votes
0 votes
1 answer
2
1 votes
1 votes
1 answer
4
makhdoom ghaya asked Jul 4, 2016
1,793 views
Match the following with respect to I/O classes in object oriented programming $:$$\begin{array}{clcl} & \textbf{List – I}&& \textbf{List – II} \\ \text{a.} & \text{...