title: Why the size of a class is getting increased by 1 if I inherit more than 2 classes in C++
body: <p>In the following code snippet, If I inherit the first 2 classes the size of derived class is 1, from omwards if inherit more number of classes to derived the size of derived class is getting incresed by those many number of classes. Why?</p>
  
  <pre><code>// Remove the comment one by one at derived class (//Base1, //Base2//, Base3//, Base5, //Base6) and check.
  
  struct Base {
      Base(){}
  };
  struct Base1 {
      Base1(){}
  };
  struct Base2 {
      Base2(){}
  };
  struct Base3 {
      Base3(){}
  };
  struct Base5 {
      Base5(){}
  };
  struct Base6 {
      Base6(){}
  };
  struct Derived : Base, Base1, Base2//, Base3//, Base5, //Base6
  {
  public:
      Derived(){}     
  };
  
  int main() {
      Derived der;
      cout &lt;&lt; "Sizeof der: " &lt;&lt; sizeof(der) &lt;&lt; endl;
  }
  </code></pre>