title: about sizeof Class in C++
body: <p>Output is 1,4,8,why c = 8,is not 1+4.If nothing in Base, sizeof(Base) = 1.and sizeof(A) = 1.In my understanding sizeof(A) is 4.why the result shows 1.</p>
  <pre><code>```
  class Base{};
  class A{
      Base a;
  };
  class B{
      int b;
      
  };
  class C{
      Base a;
      int b;
      
  };
  
  int main()
  {
      int a = sizeof(A);//1
      int b = sizeof(B);//4
      int c = sizeof(C);//8
      cout&lt;&lt;a&lt;&lt;endl;
      cout&lt;&lt;b&lt;&lt;endl;
      cout&lt;&lt;c&lt;&lt;endl;
      return 0;
      
  }```
  </code></pre>