fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct S {
  5. void foo() {
  6. cout << 1 << endl;
  7. }
  8. void foo() const {
  9. cout << 2 << endl;
  10. }
  11. };
  12.  
  13. void bar(S& a) {
  14. a.foo();
  15. }
  16.  
  17. int main() {
  18. S a;
  19. bar(a);
  20. return 0;
  21. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
1