fork(5) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct sum
  5. {
  6. int val;
  7. sum(int a) : val(a) {}
  8.  
  9. sum operator()(int a) { return val + a; }
  10.  
  11. operator int() { return val; }
  12. };
  13.  
  14. sum f(int a)
  15. {
  16. return a;
  17. }
  18.  
  19. int main() {
  20. std::cout << f(1)(2)(3)(4) << std::endl;
  21. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
10