I have a c++ class, let’s say it’s called c, and I want to use the implicit copy constructor in one of the methods, like this:
c c::do_something() { c copy = this; //I want implicit copy constructor here! copy.something_else(); //........// return copy; }
However, gcc returns this error:
error: invalid conversion from ‘c* const’ to ‘long unsigned int’
(I have another constructor from long unsigned int present)
… as if the copy constructor didn’t exist. What am I doing wrong?
this is a pointer to an object so it should be