0
what is tha work of using name space?
why do we use it? can't we make a program without it?
4 RĂ©ponses
+ 1
It's a solution to eliminate name conflict
+ 1
You can program without ever using a namespace globally! Many programmers think this is best practice too. Because if didn't write `using namespace std;`, we would have to write `std::cout`, `std::cin`, etc. for all the standard library functions. While this saves a lot of effort, imagine you started using a global namespace for this one library that had a `vector` function. Then one day you load up another global namespace for another library that also has a `vector` function in it. You now have two `vector` functions, how do you differentiate them? If you remove your namespace for each, you'll be calling them more like this: `math::vector`, and this: `newLibrary::vector`. This is why programmers consider using namespaces a bad thing. As a beginner, this is alright though, just be careful in the future. ;)
0
pta nhi
0
u can make a program without using namespace std; ,for u to code without using namespace u have to put"::std before and after ur cout statement