नोट
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप साइन इन करने या निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
'identifier' : elements of partially initialized array must have a default constructor
Remarks
Too few initializers were specified for an array of user-defined types or constants. If an explicit initializer and its corresponding constructor are not specified for an array member, a default constructor must be supplied.
This compiler error is obsolete in Visual Studio 2022.
Example
The following example generates C2073. Source file C2073.cpp:
// C2073.cpp
class A {
public:
A( int ); // constructor for ints only
};
A a[3] = { A(1), A(2) }; // C2073, no default constructor
A fix is shown here in source file C2073b.cpp:
// C2073b.cpp
// compile with: /c
class B {
public:
B(); // default constructor declared
B( int );
};
B b[3] = { B(1), B(2) }; // OK