You are on page 1of 1

#include<iostream.

h>
#include<conio.h>
class XYZ;
class ABC
{
int a;
public :
void getValue(int a1)
{
a=a1;
}
friend void max(ABC,XYZ);
};
class XYZ
{
int x;
public:
void getValue(int x1)
{
x=x1;
}
friend void max(ABC,XYZ);
};
void max(ABC ob1,XYZ ob2)
{
if(ob1.a > ob2.x)
cout<<"\n MAX is : "<<ob1.a;
else
cout<<"\n MAX is : "<<ob2.x;
}

int main()
{
clrscr();
ABC ob1;
XYZ ob2;
ob1.getValue(10);
ob2.getValue(8);
max(ob1,ob2);
getch();
return 0;
}

You might also like