नोट
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप साइन इन करने या निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
'type' : ref class does not have a user-defined copy constructor
Remarks
In a /clr (Common Language Runtime Compilation) compilation, the compiler will not generate a copy constructor for a reference type. In any /clr compilation, you must define your own copy constructor for a reference type if you expect an instance of the type to be copied.
For more information, see C++ Stack Semantics for Reference Types.
Example
The following example generates C3073.
// C3073.cpp
// compile with: /clr
ref class R {
public:
R(int) {}
};
ref class S {
public:
S(int) {}
S(const S %rhs) {} // copy constructor
};
void f(R) {}
void f2(S) {}
void f3(R%){}
int main() {
R r(1);
f(r); // C3073
f3(r); // OK
S s(1);
f2(s); // OK
}