Is there a decent alternative to dynamic_cast
<p>I am working on a c++ project, and facing a design issue currently. I would appreciate it if someone can give me some suggestions. Basically, I have a base class Base, and a subclass Derived as below. Class Derived can do something that class Base cannot do. </p>

<pre><code>class Base
{
public:
   virtual bool IsCapableOfDoingA() {return false;}
}

class Derived: public Base
{
public:
   bool IsCapableOfDoingA() {return true;}
   void DoA();
}
</code></pre>

<p>In another place where I have a pointer of type class Base.</p>

<pre><code>void functionA(Base *pBase)
{
   if (pBase &amp;&amp; pBase-&gt;IsCapableOfDoingA())
   {
      Derived *pDerived = static_cast&lt;Derived*&gt;(pBase);
      pDerived-&gt;DoA();
   }

}
</code></pre>
