What do you understand by friend-functions? How are they used?



What do you understand by friend-functions? How are they used?..

Answer / Rahul Harshawardhan

"Friend functions are non-member functions that have access to private and protected members of a class in C++. They are defined outside the class definition and can be used for performing operations on objects without being a member of the class. Friend functions are useful when it is necessary to write a function that requires direct access to the private or protected members of a class, but doesn't need to be associated with any specific object.".

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

State the difference between realloc and free.

1 Answers   Aricent,


how to print "hai" in c?

13 Answers   TCS,


What does a function declared as pascal do differently?

1 Answers  


What do you mean by scope of a variable in c?

1 Answers  


How can I change their mode to binary?

1 Answers  


What is the acronym for ansi?

1 Answers  


consagous technology placement paper

3 Answers   Consagous, Sypra,


What are Macros? What are its advantages and disadvantages?

1 Answers   TCS,


Program to find the sum of digits of a given number until the sum becomes a single digit

8 Answers   InterGraph,


Write a C++ program to generate 10 integer numbers between - 1000 and 1000, then store the summation of the odd positive numbers in variable call it sum_pos, then find the maximum digit in this variable regardless of its digits length.

1 Answers  


Write a C program to remove the repeated characters in the entered expression or in entered characters(i.e) removing duplicates

3 Answers  


Explain what is the difference between functions abs() and fabs()?

1 Answers  


Categories