fork download
  1. #include <iostream>
  2.  
  3. class C {
  4. public:
  5. void func() { std::cout << "Hello, world" << std::endl; }
  6. };
  7.  
  8. int main() {
  9. C *obj = new C();
  10.  
  11. void (C::*f)();
  12. f = &C::func;
  13. (obj->*f)();
  14.  
  15. delete obj;
  16. return 0;
  17. }
  18. /* end */
  19.  
Success #stdin #stdout 0s 4284KB
stdin
Standard input is empty
stdout
Hello, world