The header file should never contain directives using namespace N; in a global area.
It will force many identifiers from N to all client code.
But this may be good if it is inside the X namespace. Just keep in mind that the client code that is using namespace X; , will also receive all identifiers from N A more conservative approach is to have a bunch of using declarations in the X namespace, for example. using N::foo; .
An alternative is when the reason for using namespace N; is that N is a very long name, for example Not_short_enough_for_practical_use , is to use a namespace alias - preferably in the smallest amount where necessary:
namespace N = Not_short_enough_for_practical_use;
Your teacher "corrects" moving a using namespace from the namespace before it has a negative value.
You should always strive (within practical limits) to minimize the volume of everything.
source share