I want to know how the operator+ member function and operator= member will be written for below statements in main.
I do not want to add friend functions.
int main(){
A obj1, obj2, obj3;
obj2 = obj1 + 10;
obj3 = 20 + obj1;
return 0;
}
//Below is my class
//Please add necessary assignment and additions operator+ functions
class A{
int i;
public :
A(){i = 0;}
A& operator=(const A &obj){
i = obj.i;
return *this;
}
};