This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!
Compiler Error C2536
'class::identifier' : cannot specify explicit initializer for arrays
A member of a class, structure, or union could not be initialized.
Possible causes
- A constructor is not available to initialize one or more members of an array. If the size of the array is greater than the number of initializers, a default constructor must be defined.
- A nonstatic array declared with the const specifier. This kind of array cannot be explicitly initialized.
The following sample generates C2536:
class C {
int i;
int j;
int k;
};
class D {
C aC[5];
D() : aC(1,2,3,4,5) { // C2536
// try ...
// D() {
}
};
void main() {
}