fork(1) download
  1. #include <cstddef>
  2. #include <iomanip>
  3. #include <iostream>
  4. #include <type_traits>
  5.  
  6. struct S1 {
  7. private:
  8. int a;
  9. public:
  10. char b;
  11. };
  12.  
  13. struct S3 : S1 {
  14. char c;
  15. };
  16.  
  17. int main()
  18. {
  19. std::cout << sizeof(S1) << "\n";
  20. std::cout << sizeof(S3) << "\n";
  21. std::cout << std::boolalpha << std::is_standard_layout<S1>::value << "\n";
  22. std::cout << std::boolalpha << std::is_standard_layout<S3>::value << "\n";
  23. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
8
8
false
false