fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Printer
  5. {
  6. public:
  7. void println(const char* string_pointer) { cout << string_pointer << endl; }
  8. };
  9.  
  10. int main(int argc, char** argv)
  11. {
  12. void(*println_ptr)(Printer*, const char*) = reinterpret_cast<void (*)(Printer*, const char*)>(&Printer::println);
  13. Printer printer;
  14. println_ptr(&printer, "beans on toast");
  15. }
Success #stdin #stdout 0s 4392KB
stdin
Standard input is empty
stdout
beans on toast