Namespaces in C ++ are not the same as in .Net, ActionScript, and Java (which share the same concept). They are not at all the essence.
In C ++, namespaces are where encapsulation of several types and functions is required in a named context - a namespace. This applies only to names and access to names.
In .Net, ActionScript, and Java, namespaces are more about modules than about names. They force the developer to develop their code in separate namespaces, each of which is associated with one goal, context. Since these languages ββare dynamic (instead of static, like C ++), namespaces allow late type binding to code, which makes compilation fast because you only need to have the canonical name (namespace + name) of the type that you want to use in file
In C ++, there is no module command, only compilation units that do not know about each other at all.
Now about their use, it is often useful to use a namespace in C ++ to encapsulate a module (executable or dll / so), some implementation code, or any useful part of the code. However, most of the time itβs better not to have a too deep hierarchy of namespaces. For historical reasons, many C ++ developers did not even know that C ++ has a function called namespace. Now what we call "modern C ++" suggests that you know about it, but a lot of the old C ++ code is still in use today and maybe this is what you look at when you talk about spaces names.
C ++ namespaces, which are another function different from other languages, also make the record more or less obvious in the code. Actually, it is so different that you cannot handle it the same way, generally speaking, it is very difficult to understand the code when you say .Net. Thus, you should not take namespaces the same way between languages, these are really different concepts.