Cpp 5: Don’t Use using namespace Directive

A Naming Conflict Example with using namespace Directive in C++
coding
cplusplus
Author

Tony Phung

Published

September 7, 2025

1. using namespace

If your program is super simple and:

  • will not change and
  • you’re 100% confident that
    • there will be no updates or
    • no changes to the program,
  • even then
    • STILL DONT use using namespace!

But if you’re forced at gunpoint 🔫, then fine.

2. Scenario 1: No Naming Conflicts

Compilation Successful!

3. Scenario 2: Naming Conflicts

Compilation Error!