My current implementation uses lots of copy constructors with this syntax
MyClass::Myclass(Myclass* my_class)
Is it really (functionnaly) different from
MyClass::MyClass(const MyClass& my_class)
and why?
I was adviced that first solution was not a true copy constructor. However, making the change implies quite a lot of refactoring.
Thanks!!!
It’s different in the sense that the first isn’t a copy constructor, but a conversion constructor. It converts from a
MyClass*to aMyClass.By definition, a copy-constructor has one of the following signatures:
12.8. Copying class objects
EDIT: you seem to be confusing the two.
Say you have:
They serve different purposes alltogether.