I have 2 questions:
Why is this possible for an int variable:
foo.h:
class foo{
private:
const static int a = 42;
};
but for a string variable I need to do it this way?
foo.h:
class foo{
private:
static string fooString;
};
foo.cpp:
string foo::fooString = "foo";
And also:
In my particular case foo::fooString should represent a path variable, and I would like that for every object of class foo there were just one instance of foo::string, representing a const value that should never change.
Is there another way to solve this problem?