The using-directive is often confused with a using-declaration. A using-declaration adds a given name to a local scope whereas a using-directive does not; it simply makes names accessible in the scope in which they were declared. For example:namespace X { int i=0, j=0, k=0; }int k=42; // global scope// using-directive example:void f1 (void) {int i=0; // local scopeusing namespace X; // make names from X accessiblei++; // local ij++; // X::jk++; // error: X::k or global k?::k++; // global kX::k++; // X::k}// using-declaration example:void f2 (void) {int i=0; // local scopeusing X::i; // error: i declared twice!using X::j; // okusing X::k; // hides global ki++;j++; // X::jk++; // X::k}Polluting the global namespace should always be avoided in non-trivial applications, however we often encounter tutorial code with an implied using namespace std; directive in the global scope to help the student focus on the actual code. We would never do this in production code. Ideally, the only name that should ever be visible in the global scope is the global main function. Everything else should ideally be put in their own namespaces and only imported into a local scope as and when they are actually needed. If we should require additional names to be accessible in the global scope, then these should be limited to just those names which represent truly global concepts.Large programs tend to use a lot of namespaces and it can be tedious typing them out in full, particularly when they are nested or long and descriptive names. A using-declaration (at local scope) helps us to isolate just those names we are actually interested in, but if we need to use a lot of names from the same namespace, a using-directive helps cut down on the verbosity.Namespace aliases are also useful for reducing long, descriptive names to a less verbose form in order to aid readability:namespace American_Telephone_and_Telegraph { /* ... */ } // too long// ...namespace ATT = American_Telephone_and_Telegraph; // aliasYou might ask why the programmer didn't simply use ATT in the first place, but short names greatly increase the risk of a name-clash. Thus it is better for the programmer to introduce shorthand aliases as and when they are actually required.Naturally, we should avoid using-directives, using-declarations and namespace aliases in headers, because we cannot predict exactly where those names might be included, resulting in namespace pollution that can lead to some very obscure or subtle errors that would be difficult to track down.