fork download
  1. #include <iostream>
  2.  
  3.  
  4. struct Light {
  5. float print(const char* s) { std::cout << s ; return 4.2f; }
  6. };
  7.  
  8.  
  9. int main() {
  10. float (Light::*fpAction)(const char*) = &Light::print;
  11. Light b;
  12. float f = (b.*fpAction)("Hello world\n");
  13. std::cout << f;
  14. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
Hello world
4.2