Link to home
Start Free TrialLog in
Avatar of Daniel Wilson
Daniel WilsonFlag for United States of America

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!
ASKER CERTIFIED SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Daniel Wilson

ASKER

That compiles ... I think you got it.

Thanks!