To clear up some of the confusion:
If you want to declare a class member variable which is NOT an instance variable (so, one per class, not one per instance of the class), in a header file and define it in a source file, you do it like this:
// In header file
class Foo {
static Bar baz;
};
// In source file
Bar Foo::baz(args);
However, if you want to do the same thing for a variable that isn't a class member, you do it like this:
// In header file
extern Bar baz;
// In source file
Bar baz;
Note that in one case we use 'static' and in the other case we use 'extern'.
The word 'static' has multiple meanings in C++, and unfortunately this one is a bit confusing, but when appearing as part of a class variable declaration, it acts pretty much the same way as 'extern' does for an ordinary variable.
(I would have preferred that they use 'extern' rather than 'static' for declaring class member variables also, rather than adding yet another new meaning to 'static'. I think 'extern' for this usage would have been clearer, but that ship has long since sailed, so we have to deal with the language as it is, not as we would like it to be.)
inlinein header inside class.A, or should the array be shared by all object instances ofA? That decides the use ofstaticor not.std::array<int, 5>instead ofint[5]