fork download
  1. #include <iostream>
  2. struct Test
  3. {
  4. void(*func)();
  5. } n;
  6.  
  7. void extn() { std::cout << "hi!\n"; }
  8.  
  9. int main()
  10. {
  11. n.func = extn;
  12.  
  13. void (*Test::*pF)() = &Test::func;
  14.  
  15. (n.*pF)();
  16. }
  17.  
Success #stdin #stdout 0.02s 2724KB
stdin
Standard input is empty
stdout
hi!