fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Strip{
  5. public:
  6. typedef void(Strip::*LOG)(const std::string&);
  7. void log(const string& s)
  8. {
  9. cout << "log() called\n";
  10. }
  11. };
  12.  
  13. class Observable{
  14. public:
  15. Observable( Strip::LOG l )
  16. {
  17. Strip s;
  18. (s.*l)("string");
  19. }
  20. };
  21.  
  22. int main() {
  23.  
  24. Strip::LOG log = &Strip::log;
  25. Observable o( log );
  26. return 0;
  27. }
Success #stdin #stdout 0s 3428KB
stdin
Standard input is empty
stdout
log() called