Hi everyone, I'm trying to place an array of "unsigned int" in a class, but I don't seem to get it right. I know that in a class you can't initialize variables unless you do it inside a function, or else you can initialize them where you define them, as long as they are "const static"...
So I try to place my "unsigned int" array in the class's declarations, but I get so many errors. This is what it looks like in the class (not inside any function):
(The array's values aren't really these here...) Sometime I get an error telling me that I can't initialize variables, unless they're "const static", sometimes it tells me that I have a problem with the "{", as if it was unexpected... And worst, if I try to use the array, I ge errors telling that my Array is not matched to any type, even though it's supposed to be "const static unsigned int"....Code:class foo { private: const static unsigned int Array[10] = {12, 456, 89, 465, 7, 4, 64, 87, 65, 123}; };
Is it possible that we can't build constants arrays?