cross-posted from: https://lemmy.ml/post/70930
I am learning C++ and in my book
using namespace std
is written in every program. I understand thatstd::cout <<"hello";
can be simply written ascout << "hello";
by using namespace std.Why?
cross-posted from: https://lemmy.ml/post/70930
I am learning C++ and in my book
using namespace std
is written in every program. I understand thatstd::cout <<"hello";
can be simply written ascout << "hello";
by using namespace std.Why?
thank you. I just got too used to using that namespace std.
I don’t blame beginners for using it. So many starter guides show
using namespace std;
without even explaining it or its pitfalls.All I can say is to get used to writting
std::
It’s not really that much work, and makes it more obvious where some calls are coming from for any readers of your code.