almost 9 years ago
Friend Function
Declaration of Friend Function
class className { ...... .... ........ friend returntype functionname(argument/s); ...... .... ........ }
Points to remember
This class can be declared anywhere i.e in public, protected or private section in the class.
E.g of Friend Function
class base { int val1,val2; public: void get() { cout<<"Enter two values:"; cin>>val1>>val2; } friend float mean(base ob); }; float mean(base ob) { return float(ob.val1+ob.val2)/2; } void main() { clrscr(); base obj; obj.get(); cout<<"\n Mean value is : "<<mean(obj); getch(); }
Starting with Chrome version 45, NPAPI is no longer supported for Google Chrome. For more information, see Chrome and NPAPI (blog.chromium.org).
Firefox and Microsoft Internet Explorer are recommended browsers for websites using java applets.
Chrome Version Support
Are you sure, you want to delete this comment?
Sign up using
0 Comment(s)