What is the use of friend function?

Answer Posted / cs thakur

Sometimes a function is best shared among a number of
different classes. Such functions can be declared either as
member functions of one class or as global functions. In
either case they can be set to be friends of other classes,
by using a friend specifier in the class that is admitting
them. Such functions can use all attributes of the class
which names them as a friend, as if they were themselves
members of that class. A friend declaration is essentially a
prototype for a member function, but instead of requiring an
implementation with the name of that class
attached by the double colon syntax, a global function or
member function of another class provides the match.

Is This Answer Correct ?    9 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can we determine whether a php variable is an instantiated object of a certain class?

520


How to split a string into array using php?

541


What is $_ files in php?

556


What is an object in php?

547


Explain what does the unset() function means?

568






What is difference between sql and php?

541


What is the meaning of php?

509


What are the different components used in php for formatting?

527


Which MySQL function would you use to select a database?

560


List few sensible functions in PHP?

560


List functions available to sort an php array?

541


Does php support function overloading?

557


How many php functions are there?

542


Tell me how can we get the error when there is a problem to upload a file?

494


Can we run php on tomcat server?

552