fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. class test {
  6. public:
  7. int operator()(int a) {
  8. return a * 2;
  9. }
  10. } t1;
  11.  
  12. cout << "a * 2 = " << t1(2) << endl;
  13. return 0;
  14. }
Success #stdin #stdout 0s 15232KB
stdin
Standard input is empty
stdout
a * 2 = 4