fork(1) download
  1. #include <cstdio>
  2.  
  3. struct widget
  4. {
  5. virtual void foo() const { std::puts("widget"); }
  6. };
  7.  
  8. struct gadget : widget
  9. {
  10. void foo() const override { std::puts("gadget"); }
  11. };
  12.  
  13. int main()
  14. {
  15. gadget g;
  16. g.foo();
  17. g.widget::foo();
  18. }
  19.  
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
gadget
widget