fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. namespace detail{
  5.  
  6. bool less(int a,int b) { return a<b; }
  7.  
  8. }//namespace detail
  9.  
  10. void function2 ( bool (*compare)(int,int) = detail::less )
  11. {
  12. if(compare(1,2))
  13. cout << "1 < 2\n";
  14. else
  15. cout << "1 >= 2\n";
  16.  
  17. }
  18.  
  19.  
  20. int main() {
  21. function2();
  22. return 0;
  23. }
Success #stdin #stdout 0s 3096KB
stdin
Standard input is empty
stdout
1 < 2