fork download
  1. #include <iostream>
  2.  
  3. struct Base
  4. {
  5. char c = '*';
  6. };
  7.  
  8. struct A : Base
  9. {
  10. char get() const { return c; }
  11. };
  12.  
  13. struct B : Base
  14. {
  15. const char& r = c;
  16. };
  17.  
  18. int main()
  19. {
  20. std::cout << sizeof(Base) << std::endl;
  21. std::cout << sizeof(A) << std::endl;
  22. std::cout << sizeof(B) << std::endl;
  23. }
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
1
1
16