J
Jesper
Hi,
Does the concept "copy constructor" from c++ excist in
c#. What is the syntax.
best regards Jesper.
Does the concept "copy constructor" from c++ excist in
c#. What is the syntax.
best regards Jesper.
Jesper said:Does the concept "copy constructor" from c++ excist in
c#. What is the syntax.
As I understand it, a copy constructor is just a constructor which
takes an instance of a class and copies all the fields into another one
- so yes, you can write that in C# using normal constructors etc.
Eric Gunnerson said:No, C# does not have the concept of copy constructors. You can write
something that looks like a copy constructor, but it won't be called from
behind the scenes. Exactly
You can define overload conversion functions, which applies to some of the
scenarios in which you'd want a copy constructor.
100 said:I dare to say that your undestanding of copy constructors is not exactly
correct.
100 said:Hi,
I dare to say that your undestanding of copy constructors is not exactly
correct.
Copy constructor in C++ is a constructor, which take as a parameter
reference to the same class. Memberwise copy is the default copy in c++, so
copy constructors are used to provide mostly a deep copy.
c#. What is the syntax.<Does the concept "copy constructor" from c++ excist in