I want something that looks like this...:
class Foo {
public:
static void myStaticInit();
static SomeType myField;
};
And inside .cpp
:
#include "SomeOtherFile.h" // contains SomeOtherType
void Foo::myStaticInit() {
SomeOtherType sot;
myField = sot.someNonStaticFunction(); // also tried Foo::myField = ...
}
... so that I can make calls like Foo::myField
. But all I get are LNK2001
errors.
Is such a design possible? Or do I have to provide individual definitions outside a function within .cpp
?