Problems with using namespaces

If you decide to “use” a namespace you are limited to the definitions in that namespace. For instance, std::cout. If you use standard and define that as your only namespace, then cout means “print to console”.

That is fine as long as that is what we mean. If I want to reuse the term cout to mean “character dies” in my own library namespace, I can do so, but I must be very explicit about which namespace I am using or the compiler can get confused.

Privacy & Terms