I've got the following h file:
#ifndef GLOBAL_DATA_H_
#define GLOBAL_DATA_H_
class GlobalData
{
public:
GlobalData();
...
private:
...
};
namespace global_data
{
static GlobalData globalDataInstance;
}
#endif
Countless files include the header file above, and access global_data::globalDataInstance. If I put a breakpoint in GlobalData's constructor body, I see that, when I run the application, the constructor gets called countless times. Why is this?