I've been writing C++ (Mostly C++98) for a while and whenever I have a class using a static variable that is being accessed by a static function I must (re?)define it.
Example:
Test.h
class Test
{
static bool m_Foo;
static void Bar();
}
Test.cpp
bool Test::m_Foo; // This is what im trying to get rid of
void Test::Bar()
{
m_Foo != m_Foo;
}
Now with bigger classes this becomes really messy and confusing, is there a better way to handle this? Im thinking that C11 or C17 would have a more modern way to do this. My google research only really shows solutions for functions.