I've a class which stores a reference to its parent, the reference is passed in the constructor. If I try to copy an instance I get an error "error C2582: 'operator =' function is unavailable" presumably down to the reference being non-assignable.
Is there a way around this, or do I just change the variable to pointer instead of reference?
e.g (over-simplified but I think has the key points):
class MyClass
{
public:
MyClass(OtherClass &parent) : parent(parent) {}
private:
OtherClass &parent;
};
MyClass obj(*this);
.
.
.
obj = MyClass(*this);