Is there any problem with declaring a class with a static member which is another class in a header. E.g:
class Stat
{
public:
int avar;
Stat();
};
class Test
{
public:
static Stat stat;
};
The reason I fear it might cause problems is that it seems very similar to declaring a global variable in a header. If included in two cpp files the global gets declared in both files leading to an error.
'stat' in the example above still needs to be created only once between two cpp files the same as a global so how can the compiler handle the one situation but not the other or is the answer that it can't?