ich einfach einen Operator + zu überlasten versuchen, und ich bin immer diese CompilerC++ Compiler-Warnung - Rückkehr lokaler Variable
reference to local variable 'tmp' returned
Hier ist der Code für die Überlast
const Int& Int::operator+(const Int& p) const
{
Int tmp = value + p.value;
return tmp;
}
Hier Warnung ist die Klasse
class Int{
int value;
public:
Int() {} // default constructor
Int(int v) : value(v) {}
Int& operator=(const Int&);
const Int& operator+(const Int&) const;
};