fork download
  1. #include <iostream>
  2. struct Scene
  3. {
  4. void (Scene::*m_pRenderFunc)();
  5. Scene() : m_pRenderFunc(&Scene::fn1) {}
  6. void fn1() {
  7. std::cout << "fn1 is called\n";
  8. }
  9. void fn2() {
  10. (this->*m_pRenderFunc)();
  11. }
  12. };
  13. int main()
  14. {
  15. Scene sc;
  16. sc.fn2();
  17. }
  18.  
Success #stdin #stdout 0.01s 2724KB
stdin
Standard input is empty
stdout
fn1 is called