C++: Visibility of parent namespace to child namespace
<p>If you have ns2 as a child namespace of ns1, and you use ns1 classes inside a header for an ns2 class, do you need to explicitly decalre it as you would when ns1 &amp; ns2 are unrelated?</p>

<p>e.g</p>

<h2><strong>button.h</strong></h2>

<pre><code>namespace ns1
{
 class Button
 {
  ...
 };
}
</code></pre>

<h2>dialog.h</h2>

<pre><code>include "button.h"
namespace ns1
{
 namespace ns2
 {
  class TestDialog
  {
   Button *pButton;
  };
 }
}
</code></pre>

<p>Should that be right? It seems I have to change dialog.h to be:</p>

<pre><code>namespace ns1
{
 -----&gt;class Button;
 namespace ns2
 {
</code></pre>

<p>But I'm not quite sure why. Do namespaces not inherit? If I don't make this change, I get linker errors about "unresolved symbol ns1::ns2:Button::...".</p>
