A using directive provides access to all namespace qualifiers and the scope operator. This is accomplished by applying the using keyword to a namespace identifier.
The name must be a previously defined namespace. The using directive may be applied at the global and local scope but not the class scope. Local scope takes precedence over global scope by hiding similar declarations with some exceptions.
namespace A {
int i;
}
namespace B {
int i;
using namespace A;
}
void f()
{
using namespace B;
i = 7; // error
}
In this example, attempting to initialize i within
function f() causes a compiler error, because function f() does
not know which i to call; i from
namespace A, or i from namespace B.