What effect does static const have on a namespace member
- by user144182
namespace MyNamespace {
static const double GasConstant = 1.987;
Class MyClass
{
// constructors, methods, etc.
};
};
I previously had GasConstant declared within the MyClass declaration (and had a separate definition in the source file since C++ does not support const initialization of non-integral types). I however need to access it from other files and also logically it seems like it should reside at the namespace level.
My questions is, what effect does static const have in this case? Clearly const means I can't assign a new value to GasConstant, but what does a static member at the namespace mean. Is this similar to filescope static effect, where the member is not accessible outside of the unit?