Is it better programming practice to use the name space std?
Is it better to do this:
std::cout << "hi" << std::endl;
Or this:
using namespace std;
cout << "hi" << endl;
Why are there two different ways to do this and which way is better programming practice?
EDIT:
I still would like to know why we have two different ways of calling these functions, especially since it is known that issues can arise from using namespace. So why do we even have namespace? Isn't it safer just to call like std::cout
. Why do they allow us to use it if it can cause errors?