title: Can someone please explain the results returned by 'sizeof' in this code
body: <p>I don't undertand the output shown below.  </p>
  
  <p>I know that whenever a virtual function is present it creates a <code>vptr</code> but still the size printed is more than I would expect:</p>
  
  <pre><code>#include&lt;iostream&gt;
  using namespace std; 
  
  class Base
  {
   int x;
   int y;
   int z;
  public:
   virtual void fun(){}
   virtual void fun2(){}
  };
  
  class Derived:public Base
  {
   public:
    void fun() override {} 
  };
  
  int main(int argc, char const *argv[])
  {
    cout&lt;&lt;sizeof(Base)&lt;&lt;endl;
    cout&lt;&lt;sizeof(Derived)&lt;&lt;endl;
    cout&lt;&lt;sizeof(int)&lt;&lt;endl; 
  }
  </code></pre>
  
  <blockquote>
    <p>24<br>
    24<br>
    4<br>
    [Finished in 0.3s]</p>
  </blockquote>