Definition of constant within namespace in cpp file

后端 未结 3 1409
青春惊慌失措
青春惊慌失措 2021-01-15 01:22

I\'ve approached this strange ( for me ) effect in VS 2010. Can anyone smart shed some light on it please.

//Header.h
#include 
namespace MySpa         


        
3条回答
  •  粉色の甜心
    2021-01-15 01:48

    You can alternatively write:

    const std::string MySpace::SOME_CONST_STRING = "CONST_STRING_VALUE";
    

    That name is declared inside MySpace so you have to refer to it as such.

提交回复
热议问题