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 |
How would you stop a class from class from being derived or inherited.
What is memory leak and memory corruption?
What are the different forms of polymorphism??
Write A Program to find the ambiguities in Multiple Inheritance? How are they resolved.(Virtual Functions)
What is the output of the following code: int v() { int m=0; return m++; } int main() { cout<<v(); } 1) 1 2) 0 3) Code cannot compile
can main method be overloaded...??? How..????
Write a program to compute for numeric grades for a course. The course records are in a file that will serve as the input file. The input file is in exactly the following format: Each line contains a student's first name, then one space, then ten quiz scores all on one line. The quiz scores are in whole number and are separated by one space. Your program will take it input from this file and sends it output to a second file. The data in the output file will be exactly the same as the data in the input file except that there will be one additional number (of type double) at the end of each line. This number will be the average of the student's ten quiz scores. Use at least one function that has file streams as all or some of its arguments.
char* ptr = "Rahul"; *ptr++; printf("%s",ptr); What will be the output
Where You Can Use Interface in your Project
What is difference between #define and const?
How to handle exception in c++, For example in a functions i am assigning memory to some variables and also in next instructions in am dividing one variable also. If this functions generates a error while allocating memory to those variable and also while dividing the variable if i divide by zero then catch block how it will identify that this error has cone from perticular instruction
create a c++ program that will accepts 9 inputs using 3 by 3 array.