Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int my_if(bool condition, void (*do_this)(), void(*do_that)())
- {if (condition) do_this(); else do_that();}
- void print_true(){ std::cout<< "THIS IS TRUE :)" << std::endl; }
- void print_false(){ std::cout<< "THIS IS FALSE :(" << std::endl; }
- int main()
- {
- my_if(1==1, print_true, print_false);
- // equals:
- if(1==1)
- print_true();
- else
- print_false();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement