473,421 Members | 1,531 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,421 software developers and data experts.

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

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
--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...sharp/200506/1
Nov 17 '05 #1
2 1149
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.

"Mas L via DotNetMonster.com" <fo***@nospam.DotNetMonster.com> wrote in
message news:4F***********@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
--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...sharp/200506/1

Nov 17 '05 #2
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.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Mas L via DotNetMonster.com" <fo***@nospam.DotNetMonster.com> wrote in
message news:4F***********@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
--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...sharp/200506/1

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Alexander Stippler | last post by:
Hi, I wonder about the behaviour of como and icc on some very simple program. I thought initializing members of classes, which are of class type, would be 'direct initialized' (as the standard...
4
by: Tony Johansson | last post by:
Hello Experts! I have this constructor for class Flight. Flight::Flight(string flight_no, Klocka dep_t, Klocka arr_t) : no(flight_no), dep(dep_t), arr(arr_t) {} Both dep and arr are...
2
by: Pascal Polleunus | last post by:
Hi, I need to synchronize some tables from a database (master) to another one (slave). Both servers are running Debian Woody with PostgreSQL 7.2.1 (postgresql 7.2.1-2woody4). The databases are...
5
by: flamexx7 | last post by:
In the programme below is it possible to call copy constructor of class A, inside copy constructor of class B. #include <iostream> using namespace std; class A{ int a; public: A(int...
2
by: al_johnson222 | last post by:
>From any page, I want to be able to call a JS function that will do the equivelant of select all, and copy. This data will then be posted to a page that will log it. This would be easy using...
7
by: Jeffrey Barish | last post by:
(Pdb) myclass MyClass( 0, 0, 'A string', 123.45) (Pdb) copy.copy(myclass) *** TypeError: TypeError('__new__() takes at least 4 arguments (2 given)',) I see 4 arguments (actually, 5 because...
11
by: Dijkstra | last post by:
Hi folks! First, this is the code I'm using to expose the problem: ------------------------------------------------------------------ #include <functional> #include <string> #include...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.