#include <iostream>
using namespace std;
class X {
public:
void f() { cout<<"Non const"<<endl; }
void f() const { cout<<"Const"<<endl; }
};
int main() {
X x1;
const X x2;
x1.f(); // the best viable is non const if it's non commented out.
x2.f(); // the non const is not possible for a const object.
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY2xhc3MgWCB7CglwdWJsaWM6IAoJdm9pZCBmKCkgeyBjb3V0PDwiTm9uIGNvbnN0Ijw8ZW5kbDsgfQoJdm9pZCBmKCkgY29uc3QgeyBjb3V0PDwiQ29uc3QiPDxlbmRsOyB9Cn07CgppbnQgbWFpbigpIHsKCVggeDE7IAoJY29uc3QgWCB4MjsgCgl4MS5mKCk7ICAvLyB0aGUgYmVzdCB2aWFibGUgaXMgbm9uIGNvbnN0IGlmIGl0J3Mgbm9uIGNvbW1lbnRlZCBvdXQuICAKCXgyLmYoKTsgIC8vIHRoZSBub24gY29uc3QgaXMgbm90IHBvc3NpYmxlIGZvciBhIGNvbnN0IG9iamVjdC4gCglyZXR1cm4gMDsKfQ==