I want to overload the operator = and I have the following operator-function
int IntegerClass::operator=(IntegerClass integer) {
return integer.number;
}
This should be correct?
In another class I want to assign the objects private member (int) to another int i.e.
int x = integerClass;
but when I compile I get the following error
error: cannot convert 'std::IntegerClass' to 'int' in initialization
What is wrong with my implementation of operator-overloading and how should the function look like?