/*
State the output
*/
#include<iostream>
using namespace std;
class overloading
{
int value;
public:
void setValue(int temp)
{
value=temp;
}
overloading operator+(overloading ob)
{
overloading t;
t.value=value+ob.value;
return (t);
}
void display()
{
cout<<value<<endl;
}
};
int main()
{
overloading obj1,obj2,result;
int a,b;
cout<<"\n Enter the value of Complex number a,b: ";
cin>>a>>b;
obj1.setValue(a);
obj2.setValue(b);
result=obj1+obj2;
cout<<"\n Input Values: ";
obj1.display();
obj2.display();
cout<<"\n Result: ";
result.display();
return 0;
}
State the output
*/
#include<iostream>
using namespace std;
class overloading
{
int value;
public:
void setValue(int temp)
{
value=temp;
}
overloading operator+(overloading ob)
{
overloading t;
t.value=value+ob.value;
return (t);
}
void display()
{
cout<<value<<endl;
}
};
int main()
{
overloading obj1,obj2,result;
int a,b;
cout<<"\n Enter the value of Complex number a,b: ";
cin>>a>>b;
obj1.setValue(a);
obj2.setValue(b);
result=obj1+obj2;
cout<<"\n Input Values: ";
obj1.display();
obj2.display();
cout<<"\n Result: ";
result.display();
return 0;
}