fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class Father {
  6. public:
  7. void start () {
  8. this->init();
  9. };
  10.  
  11. virtual void init (){};
  12. };
  13.  
  14. class Child: public Father {
  15. void init () {
  16. cout << "I'm the child" << endl;
  17. };
  18. };
  19.  
  20. int main (int argc, char** argv) {
  21. Child child;
  22. child.start();
  23. }
Success #stdin #stdout 0s 5324KB
stdin
Standard input is empty
stdout
I'm the child