I'm wondering what memory space was used when I declared a variable and initialize a value outside of a function or method, for example,
// CBar.h>
class CBar
{
public:
CBar();
~CBar();
};
// CBar.cpp
std::string const NAME = "mr.foo";
CBar::CBar()
{
std::cout << NAME << std::endl;
}
CBar::~CBar()
{
}
The NAME variable I declared outside of the methods. Is there any problem declaring and initializing this NAME variable? And everytime I create CBar instance the NAME variable still there?
Thanks.