fork download
  1. #include <iostream>
  2. class A{int a;};
  3. class B:public A{int b;};
  4. class C:public A{int c;};
  5.  
  6. int main(){
  7. std::cout << sizeof(A) << std::endl;
  8. std::cout << sizeof(C) << std::endl;
  9. int size=3;
  10. A* a= new A[size];
  11. C c;
  12. a[2]=c;
  13. return 0;
  14. }
  15.  
Success #stdin #stdout 0.02s 2812KB
stdin
Standard input is empty
stdout
4
8