हिंदी

State Characteristics of Friend Function.

Advertisements
Advertisements

प्रश्न

State characteristics of Friend Function.

दीर्घउत्तर
Advertisements

उत्तर

  1. Even though it’s declared inside a class, it isn’t a “member.” You don’t use object.function() To call it, you just call it like a regular function.
  2. This is a common point of confusion. While it has permission to see private data, it doesn't "live" inside the object, so it must be told which object to look at using the dot operator (e.g., obj.data).
  3.  It doesn't matter if you put the friend declaration under public: or private:Its status and access rights remain exactly the same.
  4. Since it’s not a member function (and doesn’t have a this pointer), it almost always takes an object of the class as a parameter, so it has something to work on.
shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
2015-2016 (March)
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×