title: reinterpret_cast of pointer to pointer
body: <p>If I have a derived class pointer to pointer <code>Derived**</code> and wish to convert it to a base class pointer to pointer <code>Base**</code>, using <code>static_cast&lt;Base**&gt;(ppd)</code> doesn't compile, and I am forced to use <code>reinterpret_cast&lt;Base**&gt;</code>, which seems to work fine. Is there a reason for this? Is there any caveats I should bear in mind when doing this kind of reinterpret_cast?</p>
  
  <p>Below is a piece of sample code that I wrote:</p>
  
  <pre><code>struct Base {
      Base(int x0) : x(x0) {}
      int x;
  };
  
  struct Derived : Base {
      Derived(int x0, int y0): Base(x0), y(y0) {}
      int y;
  };
  
  void foo(Base** ppb) {
      *ppb = new Derived(5, 7);
  }
  
  void bar(Derived** ppd) {
      foo(reinterpret_cast&lt;Base**&gt;(ppd));
  }
  
  int main() {
      Base* pb = new Base(3);
      cout &lt;&lt; pb-&gt;x &lt;&lt; endl;
      delete pb;
  
      foo(&amp;pb);
      cout &lt;&lt; pb-&gt;x &lt;&lt; ' ' &lt;&lt; static_cast&lt;Derived*&gt;(pb)-&gt;y &lt;&lt; endl;
      delete pb;
  
      Derived* pd = new Derived(2,4);
      cout &lt;&lt; pd-&gt;x &lt;&lt; ' ' &lt;&lt; pd-&gt;y &lt;&lt; endl;
      delete pd;
  
      bar(&amp;pd);
      cout &lt;&lt; pd-&gt;x &lt;&lt; ' ' &lt;&lt; pd-&gt;y &lt;&lt; endl;
      delete pd;
  }
  </code></pre>