What is the use of friend function?

Answer Posted / vijaya

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 ?    90 Yes 15 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is meant by MIME?

823


What is the difference server side and browser side validation?

708


What is difference between static and constant in php?

725


What is meant by urlencode and urldecode?

840


Do you know what is the function func_num_args() used for?

769


Tell me how to find the position of the first occurrence of a substring in a string?

735


How the web server interprets php and interacts with the client?

716


What are majic methords in php?

831


where do we use htaccess?

736


Write a program using while loop in php?

755


What is a null coalescing operator in php7?

922


Hi this is amul jani here, i complied my graduation in B.com stream.. but as career i looking for PHP language.. to get shape my career. so is that possible to enter in IT world.. for me how much scope of develop my career in this field.. amul jani

1778


What is the difference between apache and tomcat?

769


What language is php written in?

822


Do you have to initialize variables in php?

706