Characteristics of friend function in c++
Answers
Answered by
5
if I am not wrong it must be
Friend functions have the following properties:
1) Friend of the class can be member of some other class.
2) Friend of one class can be friend of another class or all the classes in one program, such a friend is known as GLOBAL FRIEND.
3) Friend can access the private or protected members of the class in which they are declared to be friend, but they can use the members for a specific object.
4) Friends are non-members hence do not get “this” pointer.
5) Friends, can be friend of more than one class, hence they can be used for message passing between the classes.
6) Friend can be declared anywhere (in public, protected or private section) in the class
Friend functions have the following properties:
1) Friend of the class can be member of some other class.
2) Friend of one class can be friend of another class or all the classes in one program, such a friend is known as GLOBAL FRIEND.
3) Friend can access the private or protected members of the class in which they are declared to be friend, but they can use the members for a specific object.
4) Friends are non-members hence do not get “this” pointer.
5) Friends, can be friend of more than one class, hence they can be used for message passing between the classes.
6) Friend can be declared anywhere (in public, protected or private section) in the class
Similar questions