Is it wrong to use C++ 'using' keyword in a header file?

前端 未结 5 776
[愿得一人]
[愿得一人] 2020-12-19 00:28

I\'ve been told it\'s bad to have \"using namespace ns123\" in a header file, but I can\'t remember what the reason given was. Is it in fact a bad thing to do, and why?

5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-19 00:54

    Pulling all the classes and functions out of their namespace is generally a bad idea and is actually opposed to concept of having namespaces...it is usually better to use 'using' on a specific class or function.

提交回复
热议问题