fork(6) download
  1. #include <iostream>
  2.  
  3. struct iface
  4. {
  5. virtual void test(int a = 0) { std::cout << a; }
  6. };
  7.  
  8. struct impl : public iface
  9. {
  10. virtual void test(int a = 5) override { std::cout << a; }
  11. };
  12.  
  13. int main()
  14. {
  15. impl d;
  16. d.test();
  17. iface* a = &d;
  18. a->test();
  19. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
50