struct cfoobar { struct cgoobar { void goobar() const {} }; static cgoobar m_goobar; // error LNK2001: unresolved external symbol "public: static struct cfoobar::cgoobar cfoobar::m_goobar" (?m_goobar@cfoobar@@2Ucgoobar@1@A) }; int main() { cfoobar::m_goobar.goobar(); }
struct cfoobar { struct cgoobar { void goobar() const {} } static cgoobar m_goobar; }; cfoobar::cgoobar::m_goobar; //initializes m_goobar int main() { cfoobar::m_goobar.goobar(); }
#define FUNCSIG cout << __FUNCSIG__ << endl; struct cfoobar { struct cgoobar { void goobar() const { FUNCSIG } }; static cgoobar m_goobar; }; // error C2039 : 'm_goobar' : is not a member of 'cfoobar::cgoobar' // cfoobar::cgoobar::m_goobar; //initializes m_goobar //error C4430 : missing type specifier - int assumed.Note : C++ does not support default - int //cfoobar::m_goobar; // this works cfoobar::cgoobar cfoobar::m_goobar; int main() { cfoobar::m_goobar.goobar(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)