What is friend function?
Answers were Sorted based on User's Feedback
Answer / p suresh kumar
It is a non-member function, but having access to class
members.
| Is This Answer Correct ? | 49 Yes | 5 No |
Answer / kumarasamy
it is nonmember function of class it can access the
private and protected members in the class, And it is
defined by a keyword frind.........
| Is This Answer Correct ? | 36 Yes | 4 No |
Answer / lakshmi.t
If a class B is derived from A, we can access the data and
member function of A.So in order to access a class data or
function from another class we have to derive the class.
but this can be done by declaring a class as 'friend' and
can access the another class functions and data.
| Is This Answer Correct ? | 26 Yes | 8 No |
Answer / karthi
it can access private and public member function
| Is This Answer Correct ? | 9 Yes | 4 No |
Answer / mital
A friend function is used in object-oriented programming to
allow access to private or protected data in a class from
outside the class. Normally a function which is not a
member of a class cannot access such information; neither
can an external class. Occasionally such access will be
advantageous for the programmer; under these circumstances,
the function or external class can be declared as a friend
of the class using the friend keyword. The function or
external class will then have access to all information –
public, private, or protected – within the class.
| Is This Answer Correct ? | 5 Yes | 2 No |
Answer / nitish
If you are not the actual member of the class and want the
access over the functions involved in the class, then it can
be done through friend function.
An easy access to the data is provided through friend functions.
| Is This Answer Correct ? | 7 Yes | 5 No |
Answer / aravinth.p
its is a non member function,which is used to access the
private data members of a class...
it is declared inside the class by the keyword : FRIEND
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / vigneswari
FRIEND FUNCTION IS USED TO ACCESS THE DATAMEMBERS,MEMBER
FUNCTION DECLARED UNDER PRIVATE(access
specifier)...normaly we canot access the members under
private for the whole program.......BUT USING THIS
FRIENDFUNCTION WE CAN ACCESS THE FUNCTION UNDER
PRIVATE................BEST WISHES TO B A GUD
PROGRAMMER...ALL THE BEST
| Is This Answer Correct ? | 4 Yes | 4 No |
Answer / shahzad
friend function defined outside a class. friend function is
used (OBJ)to allow to assess to private ,public the class
from the outside'normally a function not a member if class
and not assess information
| Is This Answer Correct ? | 0 Yes | 0 No |
What is an object?
what is function overloading..?
suppose A is a base class and B is the derved class. Both have a method foo which is defined as a virtual method in the base class. You have a pointer of classs B and you typecast it to A. Now when you call pointer->foo, which method gets called? The next part of the question is, how does the compiler know which method to call?
Is this job good for future? can do this job post grduate student?
what is the difference between class and structure in C++?
Which method cannot be overridden?
whats the difference between c and c++
WAP to generate 2n+1 lines of the following pattern on the computer screen:
String = "C++ is an object oriented programming language.An imp feature of oops is classes and objects".Write a pgm to count the repeated words from this scenario?
what is the difference between <stdio.h>and "stdio.h"?
What is a macro? And how is a macro same as a template?
wht is major diff b/w c and c++?