fork download
  1. #include <functional>
  2. #include <iostream>
  3.  
  4. class Foo final
  5. {
  6. public:
  7. void bar() noexcept
  8. {
  9. std::cout << "Wer Party machen kann, kann auch arbeiten." << std::endl;
  10. }
  11. };
  12.  
  13. void f(std::function<void()> cb)
  14. {
  15. cb();
  16. }
  17.  
  18. int main()
  19. {
  20. const Foo foo;
  21. f(std::bind(&Foo::bar, foo));
  22.  
  23. return 0;
  24. }
Success #stdin #stdout 0.01s 5320KB
stdin
Standard input is empty
stdout
Wer Party machen kann, kann auch arbeiten.