What is friend function?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why do we use class?

638


How to use CMutex, CSemaphore in VC++ MFC

4333


What is persistence in oop?

677


How to hide the base class functionality in Inheritance?

640


what's the basic's in dot net

1742






Plese get me a perfect C++ program for railway/airway reservation with all details.

3431


What is polymorphism explain?

695


2. Give the different notations for the class.\

1594


class type to basic type conversion

1843


Get me a number puzzle game-program

1696


Which type does string inherit from?

618


write a code for this. serial_number contained in the header of the file will be read , if this serial number is less than a previous serial number within a successfully processed file, or is the same as another serial number within a successfully processed file, or if the field contains anything other than 7 digits, then the file must error with the reason ‘Invalid SERIAL_NUMBER’.

1783


What is the main purpose of inheritance law?

673


hi, this is raju,iam studying b.tech 2nd year,iam want know about group1 and group2 details, and we can studying without going to any instutions? please help me.

1545


Is data hiding and abstraction same?

572