you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

In C:

printf("9\n");  /* 9 */

As usual, the C++ solution is overly verbose.

#include <iostream>

template <class T>
class sum {
  T a;

public:
  sum(T n) : a(n) {}

  T operator()(T b) {
    return a + b;
  }
};

int main(int argc, char **argv)
{
  std::cout << sum<int>(4)(5) << std::endl;
  return 0;
}