fork download
  1.  
  2. #include <iostream>
  3.  
  4. class sayhi
  5. {
  6. public:
  7. void hi(){std::cout<<"hello"<<std::endl;}
  8. };
  9.  
  10. class greet: public sayhi
  11. {
  12. public:
  13. virtual void hi(){std::cout<<"hello world"<<std::endl;}
  14. };
  15.  
  16.  
  17. int main()
  18. {
  19. greet noob;
  20. noob.hi();
  21. return 0;
  22. }
  23.  
Success #stdin #stdout 0s 2852KB
stdin
Standard input is empty
stdout
hello world