Namespace Problems

If you do use namespaces you need to beware of namespace clashes, that is when methods are using the same name in multiple namespaces making it hard to tell which method we want to use.

The compiler should give you an error if it can’t figure out which method to use. In the example of cout, the solution would be to write std::cout instead of cout to instruct the compiler which cout you intend to use.

Privacy & Terms