namespace CounterNameSpace {
int upperbound;
int lowerbound;
using namespace NS;//Error
}
namespace NS {
int i;
}
// ...
namespace NS {
int j;
}
In the above case it shows an error .
error C2871: ‘NS’ : a namespace with this name does not exist
I know if i define NS before counternamespace problem will be solved . But just want to know whether any thing like forward declaration of namespace exist in c++ or not .So that the above problem will be resolved without defining NS before counternamespace .
please help .
Nothing says a namespace needs all of its contents right away:
However, this might not do what you want. You still won’t be able to use any of the types in that namespace until you’ve declared them.