- 1

What to write in the place of using namespace?

2nd Oct 2021, 9:22 PM
Taufique Alam
Taufique Alam - avatar
3 ответов
+ 2
Every library function in C++ is inside the namespace "std". So every time you want to access a library function, you have to mention the namespace it's inside, like std::cout, std::swap(), etc... But for simplicity and some other important reasons(backwards compatibility and to not break already written programs), "using namespace std" line was used. If you use this line, you're telling the compiler "if you don't find any function/class/etc... I mentioned, search it inside the namespace "std". But I recommend you not to use this. Why? Look here:https://www.tutorialspoint.com/why-using-namespace-std-is-considered-bad-practice-in-cplusplus#:~:text=While%20this%20practice%20is%20okay,situation%20is%20called%20namespace%20pollution.
3rd Oct 2021, 2:24 AM
Rishi
Rishi - avatar
+ 1
Why you want to write something in place of it? do you know what `using namespace` statement means? https://en.cppreference.com/w/cpp/keyword/using
3rd Oct 2021, 1:10 AM
Ipang