Exact Duplicate: Do you prefer explicit namespaces or ‘using’ in C++?
Which of these is a preferred convention for using any namespace?
using namespace std;
or
using std::cin;
using std::cout;
or
calling the function as and when required in the code?
std::cout<<"Hello World!"<<std::endl;
A very good explanation is given here.
The first style i.e. using namespace whatever defeats the whole purpose of namespacing. You should never be using it except in small code snippets. (I don’t use it there either! 😀 )
Second one is way too verbose. Not practical.
I personally like the third style i.e. typing out the fully qualified name (e.g. std::cout).
Remember, the code is read much more times than it is written & using fully qualified names IMO makes your code more readable.