I have a simple class, intended to convert integers to byte arrays.
class mc_int {
private:
int val; //actual int
public:
int value(); //Returns value
int value(int); //Changes and returns value
mc_int(); //Default constructor
mc_int(int);//Create from int
void asBytes(char*); //generate byte array
mc_int& operator=(int);
mc_int& operator=(const mc_int&);
bool endianity; //true for little
};
For conversion and simpler usage, I decided to add operator= methods. But I think my implementation of mc_int& operator=(const mc_int&); is incorrect.
mc_int& mc_int::operator=(const mc_int& other) {
val = other.value();
// |-------->Error: No instance of overloaded function matches the argument list and object (object has type quelifiers that prevent the match)
}
What could this be? I tried to use other->value(), but that was wrong too.