- 1
What to write in the place of using namespace?
3 Antworten
+ 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.
+ 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
0
https://www.sololearn.com/discuss/433046/?ref=app
https://www.sololearn.com/discuss/2021244/?ref=app
https://www.sololearn.com/discuss/611594/?ref=app
https://www.sololearn.com/discuss/360093/?ref=app
https://www.sololearn.com/discuss/1792919/?ref=app
https://www.sololearn.com/discuss/1819156/?ref=app
https://www.sololearn.com/discuss/26079/?ref=app