0

importance of "using namespace std" in C++

why is it important to mention Using namespace std in a basic hello world c ++ program?

24th Aug 2020, 6:10 AM
Anjani priya Chennuri
Anjani priya Chennuri - avatar
3 odpowiedzi
+ 5
24th Aug 2020, 6:20 AM
Kevin ★
+ 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.
24th Aug 2020, 6:24 AM
A S Raghuvanshi
A S Raghuvanshi - avatar