I've got two questions.
Question 1: Can someone provide an example of how to define/redefine a variable in a namespace. I've provided my own guess for you to base an your answer from.
// namespace.hpp
namespace example
{
static string version;
static int x;
}
And then in a .cpp how do I redefine those variables?
// namespace.cpp
namespace example
{
version = "0.1"; // ?????
x = 0; //???
}
Question 2: How would I attach a permanent class object onto a namespace from the same .hpp file? Something like this:
// namespace.hpp
class Idk
{
public:
int doThis();
}
namespace example
{
Idk idkObject;
}
The code above, when included multiple times (from different files) will replace the object, which will cause compilation errors. Once again, I need a permanent way to attach a object to a namespace its header file.