If I try to compile the object below I get the error:
1 2
note: ‘constexpr Object::Object(const Object&)’ is implicitly declared as deleted because
‘Object’ declares a move constructor or move assignment operator
If I put in a move and copy constructor, that fixes the error, but I don't understand why the error exists. Can someone explain why the error exists?
1 2 3 4 5 6 7 8 9 10 11 12 13
class Object
{
private:
int number;
public:
Object();
Object& operator=(const Object& s);
Object& operator=(Object&& s);
};
@JLBorges
Yea, sorry, I meant to have Object as parameter to operator=, not segment. I copied and pasted a more specific code and decided to change the name and forgot to change the parameter.