Search This Blog

Sunday, 23 August 2020

Friend function call

 #include<iostream>

#include<conio.h>

using namespace std;

class xyz;

class abc

{

int a;

public:

void getA()

{

cout<<"\n\nEnter the value of A:";

cin>>a;

}

friend void max(abc,xyz);

};

class xyz

{

int x;

public:

void getX()

{

cout<<"\n\nEnter the value of X:";

cin>>x;

}

friend void max(abc,xyz);

};

void max(abc a1,xyz x1)

{

if(a1.a>x1.x)

{

cout<<"\n\nA is gretter";

}

else

{

cout<<"\n\nx is gretter";

}

}

int  main()

{

abc a;

xyz x;

a.getA();

x.getX();

max(a,x);

getch();

}


No comments:

Post a Comment

Search This Blog

Contact Form

Name

Email *

Message *

Popular Posts