title: Possible to Use typeid to Determine Parent-Child Relationship
body: <p>all the while, I am using dynamic_cast to determine Parent-Child relationship of an object.</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  class A {
  public:
      virtual ~A() {}
  };
  
  class B : public A {
  };
  
  class C : public A {
  };
  
  int main()
  {
      B b;
      std::cout&lt;&lt; typeid(b).name()&lt;&lt; std::endl;       // class B
  
      A* a = dynamic_cast&lt;A *&gt;(&amp;b);
      if (a) {
          std::cout&lt;&lt; "is child of A"&lt;&lt; std::endl;    // printed
      }
  
      C* c = dynamic_cast&lt;C *&gt;(&amp;b);
      if (c) {
          std::cout&lt;&lt; "is child of C"&lt;&lt; std::endl;    // Not printed
      }
      getchar();
  }
  </code></pre>
  
  <p>May I know is it possible that I can determine parent-child relationship, of an object, through typeid? For example, how I can know B is the child of A, by using typeid checking?</p>
  
  <p>Thanks.</p>