G
giuseppe.on.usenet
class MyClass {
public:
MyClass(int a = 0) : var(a) { };
private:
int var;
};
int main() {
/* why can I use the initialization list here? */
MyClass myArray[2] = {1, 2};
}
Obviously int myArray[2] = {1, 2} would have been correct, but I don't
understand why MyClass myArray[2] is correct as well.
public:
MyClass(int a = 0) : var(a) { };
private:
int var;
};
int main() {
/* why can I use the initialization list here? */
MyClass myArray[2] = {1, 2};
}
Obviously int myArray[2] = {1, 2} would have been correct, but I don't
understand why MyClass myArray[2] is correct as well.