title: How to identify failed casts using dynamic_cast operator?
body: <p><code>Scott Meyer</code> in his book <code>Effective C++</code> says <code>dynamic_cast</code> is used to perform safe casts down or across an inheritance hierarchy. That is, you use dynamic_cast to cast pointers or references to base class objects into pointers or references to derived or sibling base class objects in such a way that you can determine whether the casts succeeded.</p>
  
  <p>Failed casts are indicated by a null pointer (when casting pointers) or an exception (when casting references). </p>
  
  <p>I would like to get two code snippet showing the failed cast in the case of casting pointer and casting reference can be indicated.</p>