The scope of a using directive depends on its location
A using directive applies only within the scope in which it is written.
- If it is placed at global scope, it affects the entire translation unit.
- If it is placed inside a namespace, class, or function, it affects only that block.
using namespace std; // applies everywhere in this file
void f() {
using namespace std; // applies only inside f()
}