Is it proper to initialize my static member variable in the constructor class?
// CFoo.h
class CFoo
{
public:
    CFoo();
    ~CFoo();
    static std::string str;
};
// CFoo.cpp
CFoo::CFoo()
{
    str = "HELLO";
}
CFoo::~CFoo()
{
}
Thanks
Is it proper to initialize my static member variable in the constructor class?
// CFoo.h
class CFoo
{
public:
    CFoo();
    ~CFoo();
    static std::string str;
};
// CFoo.cpp
CFoo::CFoo()
{
    str = "HELLO";
}
CFoo::~CFoo()
{
}
Thanks
 
    
    You haven't define static member yet. You need to define it in CFoo.cpp.
CFoo.cpp
std::string CFoo::str;  // define str
CFoo::CFoo()
{
    str = "HELLO";  // reset str is fine
}
CFoo::~CFoo()
{
}
