fork download
  1. #include <iostream>
  2.  
  3. struct MyQuestion
  4. {
  5. void fun()
  6. {
  7. std::cout<<"a";
  8. }
  9.  
  10. void fun()const
  11. {
  12. std::cout<<"b";
  13. }
  14.  
  15. void call()
  16. {
  17. void (MyQuestion::*f)()const = &MyQuestion::fun;
  18. (this->*f)();
  19. }
  20. };
  21.  
  22. int main() {
  23. MyQuestion mq;
  24. mq.call();
  25. return 0;
  26. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
b