C#(2005) DLL using in VSC++(2005) - Needs copy constructor???

  • Thread starter Thread starter Mas L via DotNetMonster.com
  • Start date Start date
M

Mas L via DotNetMonster.com

Hi,

I have a C-sharp DLL(C#2005) and I use it as a reference in a VSC++(2005)
project.
When I

Myclass Obj = gcnew Myclass();

he says that I need a copy constructor!!??!!! Is there a way to avoid this?

Kind Regards
NETFAN
 
No, you need to create a reference variable when creating a heap allocated
object.
Myclass^ Obj = gcnew Myclass();
....
or:
MyClass Obj;
....
when creating a "stack allocated" one.

Willy.
 
NETFAN,

If you want the object to be created on the stack, then you have to
remove the gcnew keyword. If you want to hold a reference to an object,
then you have to declare a reference, which I believe you do like so:

// Create a new instance of Myclass and get the reference.
Myclass^ Obj = gcnew Myclass();

Hope this helps.
 
Back
Top