What is a friend function & its advantage?



What is a friend function & its advantage?..

Answer / kishor khatri

A friend function is a non member function of a class, that
is declared as a friend using the keyword "friend" inside
the class. By declaring a function as a friend, all the
access permissions are given to the function. It is like
allowing access to ones personal belongings to a friend.

Is This Answer Correct ?    3 Yes 1 No

Post New Answer

More OOPS Interview Questions

Round up a Decimal number in c++.. example Note = 3.5 is as 4 3.3 is as 3

3 Answers   Accenture, Cognizant, IBM,


design a c++ class for the chess board,provide a c++ class definition for such class(only class definition is required)

0 Answers   UBS,


pointers are support in C#? if yes then how to use it?

8 Answers   Softvision Solution,


class CTest { public: void someMethod() { int nCount = 0; cout << "This is some method --> " << nCount; } }; int main() { CTest *pctest; pctest->someMethod(); return 0; } It will executes the someMethod() and displays the value too. how is it possible with our creating memory for the class . i think iam not creating object for the class. Thanks in Advance... Prakash

0 Answers  


What is class and example?

0 Answers  






What does no cap mean?

0 Answers  


Program to print 0 to 9 in cross order

3 Answers  


Why do pointers exist?

0 Answers  


How is data security provided in Object Oriented languages? ?

5 Answers  


what is pointers

7 Answers   Exilant,


how to swap the variables without using temp and operators

1 Answers  


How to overload new operator in c++

2 Answers  


Categories