Node*Clone(){
numClones++;
Node*cloned=new Node(*this);
return cloned;
}
I have a default constructor (taking no arguments) and I have no declared copy constructors, so I'd expect this to simply copy the entire contents of the memory of *this
and return a pointer to it.
However, I am getting error on the new
line above:
Call to implicitly deleted copy constructor
Two possible issues but I don't think they should affect this:
this
has aunique_ptr
attached to it. That is it contains a container of unique_ptr and is itself stored in another container of unique_ptr. But I am not moving that pointer, I am creatingnew
object not attached to the prior object, right?this
is actually a subclass ofNode
but I want to return a pointer to a base class