First off, I'm not a complete idiot, so by "explicitly" I don't mean like this:
MyClass imAnIdiot.MyClass(params);
Here's what I'm getting at. If you have written a copy constructor for a class, is it legal to invoke this constructor in a "new" statement as follows?
MyClass oldObject(param1, param2);
MyClass* newObject = new MyClass(oldObject);
I can't imagine why not, but because the copy constructor is a special case, I thought I'd ask to be totally certain.
All I'm trying to do is create a new object that is an exact copy of the old object but without any common memory usage (i.e. no pointers to the same dynamically allocated memory). I'm probably going to end up just over-writing the assignment operator instead (makes more sense I think) but I was curious as to how this actually works.
Thanks much!