fork download
  1. #include <iostream>
  2.  
  3. class foo
  4. {
  5. public:
  6. void foo_function() { std::cout << "Foo!" << std::endl;};
  7. };
  8.  
  9. class bar
  10. {
  11. public:
  12. foo foo_member;
  13.  
  14. void bar_function(foo bar::*p_foo)
  15. {
  16. (this->*p_foo).foo_function();
  17. }
  18. };
  19.  
  20.  
  21. int main()
  22. {
  23. foo foo_obj;
  24. bar bar_obj;
  25. typedef foo bar::*p_foo;
  26. p_foo blah = &bar::foo_member;
  27. bar_obj.bar_function(blah);
  28. return 0;
  29. }
  30.  
Success #stdin #stdout 0s 3096KB
stdin
Standard input is empty
stdout
Foo!