Namespaces and overloading (C++ only)

You can overload functions across namespaces. For example:
// Original X.h:
int f(int);

// Original Y.h:
int f(char);

// Original program.c:
#include "X.h"
#include "Y.h"

int main(){
  f('a');   // calls f(char) from Y.h
}

Namespaces can be introduced to the previous example without drastically changing the source code.

// New X.h:
namespace X {
  f(int);
}

// New Y.h:
namespace Y {
  f(char);
}

// New program.c:
#include "X.h"
#include "Y.h"

using namespace X;
using namespace Y;

int main(){
  f('a');   // calls f() from Y.h
}

In program.c, the main function calls function f(), which is a member of namespace Y. If you place the using directives in the header files, the source code for program.c remains unchanged.