hello everybody
i'm wondering why doesn't this work. i just create an array in class declaration, and try to assign values to it in the object constructor...
1 2 3 4 5 6 7 8 9 10 11 12 13
class Foo{
public:
int numbers[4];
Foo(){
numbers = {1, 2, 3, 4,};
}
~Foo();
};
int main(){
Foo foo;
return 0;
}
i believe you can't initialize the array in the class declaration you have to do it in a function. also i don't believe you can't initialize it in the default constructor either.