I'm simply trying to overload a + operator and I'm getting this compiler warning
reference to local variable 'tmp' returned
Here is the code for the overload
const Int& Int::operator+(const Int& p) const
{
Int tmp = value + p.value;
return tmp;
}
Here is the class
class Int{
int value;
public:
Int() {} // default constructor
Int(int v) : value(v) {}
Int& operator=(const Int&);
const Int& operator+(const Int&) const;
};