मराठी
महाराष्ट्र राज्य शिक्षण मंडळएचएससी विज्ञान (संगणक विज्ञान) इयत्ता १२ वी

What is Friend Function - Computer Science 1

Advertisements
Advertisements

प्रश्न

What is Friend Function ?

उत्तर

(1) C++ allows the common function to be made friendly with more than one classes, there by allowing the function to have access to the private data of classes. Such a function need not be member of any of classes.
(2) Non-member function cannot have access to the private data of a class. However, there could be a situation where user would like two classes to share a particular function. At this situation friend
function is used.
(3) The keyword “friend” declares the function to be friendly with that class. This function is defined as a normal C++ function. The function definition does not use class-name, keyword friend or scope resolution operator.

shaalaa.com
C++ Programming
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
2016-2017 (March)

APPEARS IN

Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×