do i have to type "using namespace std;" on multiple files?

so lets say i have two files, People.h and People.cpp, both use the std functions so i declared using namespace std; on both files.

now is that necessary to type that on both files if People.h already has that "using namespace std;" line and People.cpp has #include "People.h" on the top already? or do i need to type using namespace stdl for Peopel.cpp also?
As a rule of thumb, "a header file should not include using-declarations, but instead should prefix standard-library names with std:: explicitly. In the source file, there is no problem with using-declarations. Unlike a header file, a source file has no effect on the programs that use these functions. Hence reliance on using-declarations in a source file is purely a local decision." --- from Accelerated C++.
Last edited on
I'll follow qmzh85 because, say if you code a header for reuse with he include statement, it might have conflict with other namespace functions or members used later on in say a .cpp file.

Topic archived. No new replies allowed.