fork(2) download
  1. #include <iostream>
  2.  
  3. class A {
  4. public:
  5. A() {}
  6. virtual ~A() {}
  7.  
  8. virtual void runFn() {GetPart(); }
  9.  
  10. protected:
  11. virtual void GetPart() {
  12. std::cout << "A::GetPart" << std::endl;
  13. }
  14. };
  15.  
  16. class B : public A {
  17. public:
  18. B() {}
  19. virtual ~B() {}
  20. protected:
  21. virtual void GetPart() override {
  22. A::GetPart();
  23. std::cout << "GETPART RUN" << std::endl;
  24. }
  25. };
  26.  
  27. int main()
  28. {
  29. B b;
  30. b.runFn();
  31. return 0;
  32. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
A::GetPart
GETPART RUN