fork download
  1. #include <iostream>
  2.  
  3. void fun() { std::cout << "called\n"; }
  4.  
  5. struct Game
  6. {
  7. void (*fptr)();
  8. };
  9.  
  10. typedef void (*Game::*pVoidPointer)();
  11.  
  12. int main()
  13. {
  14. pVoidPointer ptr = &Game::fptr;
  15.  
  16. Game g;
  17. g.fptr = fun;
  18.  
  19. (g.*ptr)();
  20. }
  21.  
Success #stdin #stdout 0.02s 2724KB
stdin
Standard input is empty
stdout
called