Friend Function

Program:


    #include<iostream.h>
    #include<conio.h>
class one { private; int a,b,c; public: void enter(void) { cout<<"\n Enter the value of a,b and c:\n"; cin>>a>>b>>c; } friend int largest(one big) }; int largest(one big) { int max; max=big.a; if(big.b>max) max=big.b; if(big.c>max) max=big.c; return(max); } void main() { one obj; int result; clrscr(); obj.enter(); result=largest(obj); cout<<"\n Largest of three number is: "<<result; getch(); }
Powered by nasrullah.in - TechnoNasr 2003-2020.
Designed & Developed by Mohamed Nasrullah.M