fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class A
  5. {
  6. public:
  7. void func()
  8. {
  9. cout<<"function of class A\n";
  10. }
  11. void print()
  12. {
  13. cout<<"inside A\n";
  14. }
  15.  
  16. };
  17.  
  18. class B : public A
  19. {
  20. public:
  21. void print()
  22. {
  23. cout<<"Inside B\n";
  24. }
  25. };
  26.  
  27. int main() {
  28.  
  29. cout<<"Size of class:"<<sizeof(A);
  30. B a;
  31. a.func();
  32. return 0;
  33. }
Success #stdin #stdout 0s 5304KB
stdin
Standard input is empty
stdout
Size of class:1function of class A