Here's what I've got:
void set::operator =(const set& source)
{
if (&source == this)
return;
clear();
set(source);
}
And here's the error I get:
vset.cxx:33: error: declaration of 'source' shadows a parameter
How do I properly do this?
I believe with set(source);
you are trying to call copy ctor. You can not do that in C++ i.e. you can not explicitly invoke the ctor. What you can do is write a private clone
method and call it in both copy ctor and assignment operator.