Thread TagsAdobe Illustrator Adobe InDesign Adobe Photoshop Android Development Android Programming Android Studio Automation Testing C / C++ Programming Career Options College Lounge css designed Design layout digital marketing Digital Marketing / SEO Fireworks Graphic Design Graphic designing Graphics Design Graphics Designing HTML? Illustrator Internship Training logo Design logo designing mobile phones Photoshop QA react-native Scroll Website SEO Single Page Website Testing Typography UI UI/UX Development UI Design UI Designing UI development User Interface UX Design Viewport Web Designing web pages Website Design
Log in with your username and password
Register for free!
Registration at Smart Mentors is completely free and takes only a few seconds. By registering you’ll gain:
- Full Posting Privileges.
- Access to Private Messaging.
- Optional Email Notification.
- Ability to Fully Participate.
February 4, 2019 at 10:29 am #52987
Friend function goes about as a friend of the class. It can get to the private and protected members from the class. The friend function isn’t a member from the class, however, it must be recorded in the class definition.
The non-member function can’t get to the private data of the class. At times, it is essential for the non-member function to get to the data.
The friend function is a non-member function and can get to the private data of the class.
Following are the qualities of a friend function:
1) The friend function isn’t to the extent of the class in which it has been declared.
2) Since it isn’t to the extent of the class, so it can’t be called by utilizing the object of the class. Consequently, friend function can be invoked like a normal function.
3) A friend function can’t get to the private members directly, it needs to utilize an object name and dot operator with every member name.
4) Friend function utilizes objects as contentions.
Let’s understand this through an example:
using namespace std;
friend int add(Addition x)
You must be register. Registration is 100% free.to reply to this thread.Please or