fork download
  1. struct Object{
  2. int foo(int *a){return 0;}
  3. int bar(int *a){return 1;}
  4. };
  5.  
  6. typedef int (Object::*ObjFPtrType)(int *);
  7. typedef int (Object::*&ObjFPtrTypeRef)(int *);
  8.  
  9. void setFnPtr(ObjFPtrType* p)
  10. {
  11. *p = &Object::foo;
  12. }
  13.  
  14. void setFnPtrRef(ObjFPtrTypeRef r)
  15. {
  16. r = &Object::bar;
  17. }
  18.  
  19. int main() {
  20.  
  21. ObjFPtrType p1 = 0;
  22. setFnPtr(&p1);
  23.  
  24. ObjFPtrTypeRef p2 = p1;
  25. setFnPtrRef(p2);
  26. }
  27.  
Success #stdin #stdout 0s 3292KB
stdin
Standard input is empty
stdout
Standard output is empty