Just when I thought I had pointers down, it looks like I'm still a bit confused. I'm writing the operator= overload, so I want to deallocate memory then assign new. I'm dealing with a Quad tree class, where each tree has a pointer to root node and a root node has 4 pointers to 4 children, and those each have 4 children. So the operator= should just make a copy of the other tree's root and return it. So after deallocating and such, I come to wanting to allocate new memory and assigning. So I do:
root=new QtreeNode;
root=nodeCopier(*(source.root));
And here's my nodeCopier signature:
QNode nodeCopier(const QtreeNode & n) {
QtreeNode tempNode;
//stuff
return tempNode;
}
But then I get this error error:
no matching function for call to
Qtree::nodeCopier(Qtree::QtreeNode* const&)
qtree.h:92: note: candidates are: Qtree::QtreeNode Quadtree::nodeCopier(const Qtree::QtreeNode&)
How do I fix this?