Daniel Wilson
asked on
C++ / CLI Copy Constructor grief
I'm converting another project from Managed Extensions for C++ (.Net 1.1) to C++/CLI (.Net 2+)
In this project we have some copy constructors.
Following http://www.functionx.com/cppcli/classes/Lesson13b.htm I have my copy constructor declared as
Shift(const Shift^ &otherShift);
The code that used to call it is:
Object ^Shift::Clone(){
return gcnew Shift(*this);
}
But this raises the compile error C3073: 'MyNamespace::Shift' : ref class does not have a user-defined copy constructor.
I've tried (&this), (this), (%this) -- all with varying errors.
So ... how do I call this copy constructor?
Thanks!
In this project we have some copy constructors.
Following http://www.functionx.com/cppcli/classes/Lesson13b.htm I have my copy constructor declared as
Shift(const Shift^ &otherShift);
The code that used to call it is:
Object ^Shift::Clone(){
return gcnew Shift(*this);
}
But this raises the compile error C3073: 'MyNamespace::Shift' : ref class does not have a user-defined copy constructor.
I've tried (&this), (this), (%this) -- all with varying errors.
So ... how do I call this copy constructor?
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks!