fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct A
  5. {
  6. void (A::*ptr)();
  7.  
  8. void foo() { cout << "asd" << endl; }
  9. void bar()
  10. {
  11. ptr = &A::foo;
  12.  
  13. (this->*ptr)();
  14. }
  15. };
  16.  
  17. int main() {
  18. A a;
  19. a.bar();
  20. return 0;
  21. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
asd