title: Reverse Engineering virtual functions code in C++
body: <p>I just compiled the following on VS2010(with optimization turned off).</p>
  
  <pre><code>class Shape {
    public:
      int x,y;
      Shape() {
        x=10;
        y=20;
      }
  
      virtual void function1() {
        cout&lt;&lt;"function1";
      }
  
      virtual void function2() {
        cout&lt;&lt;"function2";
      }
  };
  
  int main() {
      Shape *s = new Shape();
      s-&gt;function1();
      s-&gt;function2();    
      return 0;
  }
  </code></pre>
  
  <p>The disassembly does not show the code blocks corresponding to the virtual functions or any calls to it, so Im assuming that it is because of the way virtual functions are looked up using the vftable. I'm using IDA Pro so it is probably not able to resolve such issues. Please correct me if I'm wrong.</p>
  
  <p>I also have a few doubts in this regard.</p>
  
  <ol>
  <li>Is there any way I can view the virtual functions just as the other functions during disassembly? Any script(IDAPython)/method that I could use?</li>
  <li>Is there any way I can list all virtual functions in an executable?</li>
  <li>Suggested Reading?</li>
  </ol>