0
importance of "using namespace std" in C++
why is it important to mention Using namespace std in a basic hello world c ++ program?
2 Antworten
+ 5
Anjani priya Chennuri
The std namespace includes features of the C++ standard library such as cout and cin.
You don't need using:
https://code.sololearn.com/cU7IPo4y0YeG/?ref=app
https://www.sololearn.com/Discuss/294730/?ref=app
https://www.sololearn.com/discuss/392399/?ref=app
+ 4
In C++ the concepts are separate. This is by design and useful.
You can include things that without namespaces would be ambiguous.
With namespaces you can refer to two different classes that have the same name. Of course in that case you would not use the using directive or if you did you would have to specify the namespace of the other stuff in the namespace you wanted.
Note also that you don't NEED the using - you can just used std::cout or whatever you need to access. You preface the items with the namespace.