Why use static_cast rather than dynamic_cast in here?
<p>I copy the following text from the book More Effective C++.</p>

<p><strong>Item 31:  Making functions virtual with respect to more than one object.</strong> </p>

<pre><code>class GameObject { ... };
class SpaceShip: public GameObject { ... };
class SpaceStation: public GameObject { ... };
class Asteroid: public GameObject { ... };
</code></pre>

<p>The most common approach to double-dispatching returns us to the unforgiving world of virtual function emulation via chains of if-then-elses. In this harsh world, we first discover the real type of otherObject, then we test it against all the possibilities: </p>

<pre><code>void SpaceShip::collide(GameObject&amp; otherObject)
{
  const type_info&amp; objectType = typeid(otherObject);

  if (objectType == typeid(SpaceShip)) {
    SpaceShip&amp; ss = static_cast&lt;SpaceShip&amp;&gt;(otherObject);

    process a SpaceShip-SpaceShip collision;

  }
  else if (objectType == typeid(SpaceStation)) {
    SpaceStation&amp; ss =
      static_cast&lt;SpaceStation&amp;&gt;(otherObject);

    process a SpaceShip-SpaceStation collision;

  }
...
}
</code></pre>

<p>Here is the question:</p>

<p>Q1> Why we use static_cast here rather than obvious dynamic_cast?   </p>

<p>Q2>　Are they same in this case?</p>

<p>thank you</p>

<p>// updated //</p>

<p>In fact, I am more interested in question 2. </p>

<p>For example,</p>

<pre><code>class base {};
class subclass : public base {};

base *pSubClass = new subclass;

subclass *pSubClass1 = static_cast&lt;subClass*&gt; (pSubClass); 
</code></pre>

<p>// does the static_cast do the job correctly in this case although I know we should use dynamic_cast here?</p>
