title: How to identify a specific derived class by pointer?
body: <p>I have a piece of code, that consists of an engine, a queue of pointers of requests processed by the engine, and a set of different types of requests, all of them classes - one 'most general' and a lot of variants.</p>
  
  <p>Now, one of these request types requires a special handling.</p>
  
  <pre><code>class GenericRequest {};
  class SpecificRequest1 : public GenericRequest {};
  class SpecificRequest2 : public GenericRequest {};
  class VerySpecialRequest : public GenericRequest {};
  </code></pre>
  
  <p>The queue just contains pointers (of type <code>GenericRequest*</code>) to instances. <code>GenericRequest</code> is instantiated too - instances of it appear in the queue too.</p>
  
  <p>I need the engine to single out <code>VerySpecialRequest</code> and perform extra operations as it appears. </p>
  
  <p>If I understood the answer involving inheritance in <a href="https://stackoverflow.com/a/11510452/249618">How to identify failed casts using dynamic_cast operator?</a>, in my case using:</p>
  
  <pre><code>VerySpecialRequest* result = dynamic_cast&lt;VerySpecialRequest*&gt;( queue_entry );
  
  if(result != NULL) { /* process the special entry */ }
  </code></pre>
  
  <p>will catch instances of <code>GenericRequest</code> on top <code>VerySpecialRequest</code>, only filtering off <code>SpecificRequest1</code> and <code>SpecificRequest2</code>. </p>
  
  <p>How can I go about identifying this specific child?</p>