Program of BINARY OPERATOR OVERLOADING using Friend function

/*Program of BINARY OPERATOR OVERLOADING using Friend function*/

#include
#include
class A
{
int a,b;
public:
void getdata(int c,int d)
{
a=c;
b=d;
}
void add()
{
cout<<"addition of 'a' = "<>f>>g;
a1.getdata(f,g);
cout<<"\nEnter the value of a & b\n"; cin>>h>>i;
a2.getdata(h,i);
a3=a2+a1;
a3.add();
getch();
return 0;
}

OUTPUT :

Enter the value of a & b
3 5
Enter the value of a & b
6 9
Addition of ‘a’ = 9
Addition of ‘b’ = 14







One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *