fork download
  1. #include <iostream>
  2. #include <functional>
  3. using namespace std;
  4.  
  5. void functionA(int a);
  6.  
  7. void functionA(int a)
  8. {
  9. cout << "Thanks for calling me with " << a << endl;
  10.  
  11. if(a == 22)
  12. return;
  13.  
  14. std::function<void(int)> f_display = functionA;
  15.  
  16. f_display(22);
  17. }
  18.  
  19. int main() {
  20.  
  21. functionA(1);
  22.  
  23. return 0;
  24. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
Thanks for calling me with 1
Thanks for calling me with 22