Overloading operator ->
问题 Here is my code example: class X { public: void f() {} }; class Y : public X { public: X& operator->() { return *this; } void f() {} }; int main() { Y t; t.operator->().f(); // OK t->f(); // error C2819: type 'X' does not have an overloaded member 'operator ->' // error C2232: '->Y::f' : left operand has 'class' type, use '.' } Why the compiler is trying to "move the responsibility" for operator-> from Y to X? When I implement X::op-> then I cannot return X there - compile error says