fork(5) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Base {
  5. public:
  6. Base() {}
  7. };
  8.  
  9. class Derived : public Base {
  10. public:
  11. Derived() {}
  12. };
  13.  
  14. void DoSomething(Base b) {
  15. cout << "Do Something to Base" << endl;
  16. }
  17.  
  18. void DoSomething(Derived d) {
  19. cout << "Do Something to Derived" << endl;
  20. }
  21.  
  22. int main() {
  23. Derived d = Derived();
  24. DoSomething(d);
  25. return 0;
  26. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
Do Something to Derived