fork(1) download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. void f(int);
  5. void f(std::string);
  6. void f(int, std::string);
  7.  
  8. int main()
  9. {
  10. void (&intfunc)(int) = f;
  11. void (&stringfunc)(std::string) = f;
  12.  
  13. intfunc(7);
  14. stringfunc("Hello");
  15. }
  16.  
  17. void f(int x)
  18. {
  19. std::cout << x << std::endl;
  20. }
  21. void f(std::string s)
  22. {
  23. std::cout << s << std::endl;
  24. }
  25. void f(int x, std::string s)
  26. {
  27. std::cout << x << ", " << s << std::endl;
  28. }
  29.  
Success #stdin #stdout 0s 3428KB
stdin
Standard input is empty
stdout
7
Hello