title: C++ compilation error in static_cast< >
body: <p>Below is my code</p>
  
  <pre><code>Class A
  {
    A::A(int num) { }
    int num;
  };
  
  class B : public A
  {
    B::B(int num):A(num) { }
  };
  
  Class D;
  Class C
  {
    void getNum(A**&amp; somenum) {}
    D *dObj;
  };
  
  void C::getNum(A**&amp; somenum)
  {
    dObj-&gt;getNumber(static_cast&lt;B**&gt;(somenum)); // Error here.
  }
  
  Class D
  {
    void getNumber(B**&amp; number) 
    { 
        B someValue[5];
        // all the objects in the array are properly created and properly Initalized (skipped that part)
  
        number[0] = someValue[0]; 
        number[1] = someValue[1];
        //...
     }
  };
  </code></pre>
  
  <p>I'm getting compilation error while doing the static_cast. I am trying to assign the values in "someValue" array to "A**&amp; somenum". Can you please help how to do it.</p>
  
  <p>Thank you very much in advance. </p>