other version of cout

...this must be the dumbest question but
If we need
 
 using namespace std;

to access the standard version of cout then what does the other version of cout do?

considering that using is used to separate two objects/functions sharing the same name.

std::cout << "What other version?\n";

Edit:

If we need


We don't.

considering that using is used to separate two objects/functions sharing the same name.


Unless someone writes their own cout function - which they shouldn't. If they did it should be in it's own namespace.
Last edited on
closed account (48T7M4Gy)
@OP

http://en.cppreference.com/w/cpp/language/namespace

It's a little more complex than just worrying about cout and the potential for its duplication/collision.

In fact if cout was the only potential conflict then the criticism associated with 'why not use using namespace std' would be valid because I don't think too many people would dream up 'cout' as any sort of useful name.

If you visit https://en.wikipedia.org/wiki/C%2B%2B_Standard_Library you will get an idea of the vast scope of namespace std and hence the real potential for conflict - std is not just cout, cin and a couple of others!
Unless someone writes their own cout function
std::cout is an std::basic_ostream object but name collision should preclude functions with that name as well
Topic archived. No new replies allowed.