site:www.cplusplus.com ...
Use using namespace directives for transition, for foundation libraries (such as std), or within a local scope (only) Reason using namespace can lead to name clashes, so it should be used sparingly. However, it is not always possible to qualify every name from a namespace in user code (e.g., during transition) and sometimes a namespace is so fundamental and prevalent in a code base, that consistent qualification would be verbose and distracting. ... The use of using namespace std; leaves the programmer open to a name clash with a name from the standard library ... people who use using namespace std are supposed to know about std and about this risk. |