Advertisement
Guest User

Untitled

a guest
Dec 8th, 2021
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. /******************************************************************************
  2.  
  3.                               Online C++ Compiler.
  4.                Code, Compile, Run and Debug C++ program online.
  5. Write your code in this editor and press "Run" button to compile and execute it.
  6.  
  7. *******************************************************************************/
  8.  
  9. #include <iostream>
  10.  
  11. using namespace std;
  12.  
  13. int b(bool print_state) {
  14.     if(print_state)
  15.         cout << "print state here" << endl;
  16.     return 2;
  17. }
  18.  
  19. int a(decltype(b) ptr_b, bool x) {
  20.     return ptr_b(x);
  21. }
  22.  
  23. int main()
  24. {
  25.     cout<<"Hello World";
  26.     auto ret = a(&b, true);
  27.     cout << ret << endl;
  28.     return 0;
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement