title: Why are namespaces used?
body: <p>This is confusing me a great deal. All code examples being <code>namespaceA</code> and <code>namespaceB</code> and the method names being <code>foo()</code> and <code>bar()</code> are not helping, either. The way everyone explains it makes it seem as though namespaces are a relic of pre-OOP times where you could not say 'class car give fuel level' but had to go to this from another approach. But when I now want to do a C++ level, what is the point of using namespaces? Not that headers are confusing enough already, namespaces make absolutely no sense to me, in either how they work or why to use them.</p>
  <p>Let's say I have a project built around <code>Traffic</code>, for example. You'd have classes for the <code>Car</code>s and its components, the <code>Driver</code>s and <code>Passenger</code>s and the <code>Road</code>.
  Now, the <code>Road</code> has <code>Car</code>s and each <code>Car</code> has <code>Person</code>s. What would this look like?</p>
  <p>Would you have the namespaces <code>Road</code>, <code>Car</code>, <code>Person</code>? Would the <code>main()</code> use the namespace <code>Road</code> to access the stuff in the header? Would the namespace <code>Road</code> include the namespace <code>Car</code>, and the <code>Car</code> include the namespace <code>Person</code>, and would through this the <code>main()</code> have access to the methods in <code>Person</code>? This is the way most guides explain this, but I don't really see the advantage of this over just importing the header file, wouldn't that have the same effect?</p>
  <p>Or would you put multiple headers in the same namespace, such as <code>namespace Traffic</code> with all those classes? Can you nest namespaces?</p>
  <p>I know C# and never knew it had namespaces until I looked it up just now, and never needed it, and in Java, Python, and Dart, those also never came up. Since I am trying to teach myself C++, I am kind of stranded here now, asking this question here. So far, I also never used them in C++, but I want to learn it properly.</p>