title: Throw a derived class in catch scope
body: <p>I would like to understand what going wrong in the program that cause that <code>PE</code> which is a derived class, is not catching by the <code>second catch</code> and display the error like I want.
  In the same way, what I have to correct in order to run this simple example</p>
  <pre><code>class myEx
  {
      int errNum;
  public:
      myEx(int e) : errNum(e) {}
      virtual void printErr() { cout &lt;&lt; errNum &lt;&lt; &quot; &quot;; }
  };
  class subEx : public myEx
  {
      string errDesc;
  public:
      subEx(int e, string d) : myEx(e), errDesc(d) {}
      void printErr()
      {
          myEx::printErr();
          cout &lt;&lt; errDesc &lt;&lt; &quot; &quot;;
      }
  };
  int main()
  {
      try
      {
          myEx* pME = new subEx(0, &quot;err 0&quot;);
          throw pME;
      }
      catch (myEx* p)
      {
          p-&gt;printErr();
          subEx PE(1, &quot;err 1&quot;);
          throw PE;
      }
      catch (subEx e)
      {
          e.printErr();
      }
  }
  </code></pre>