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 that std::cout <<"hello"; can be simply written as cout << "hello"; by using namespace std.

Why?

  • @the_tech_beastOP
    link
    13 years ago

    thank you. I just got too used to using that namespace std.

    • @freely
      link
      33 years ago

      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.