fork(1) download
  1. #include <iostream>
  2.  
  3. void g_func() { std::cout << "g-func!" << std::endl; }
  4.  
  5. class Foo
  6. {
  7. public:
  8. void (*pfunc)();
  9. void (Foo::*mfunc)();
  10.  
  11. void foo_func() { std::cout << "foo-func!" << std::endl; }
  12.  
  13. Foo() :
  14. pfunc(g_func),
  15. mfunc( &Foo::foo_func )
  16. {}
  17.  
  18. };
  19.  
  20. int main() {
  21. Foo foo;
  22. foo.pfunc();
  23. (foo.*(foo.mfunc))();
  24.  
  25. return 0;
  26. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
g-func!
foo-func!