Trouble with const/non-const overload resolution
问题 I have a class that looks something like this: class ClassA { public: float Get(int num) const; protected: float& Get(int num); } Outside of the class, I call the Get() function. float foo = classAInstance.Get(i); I expect this to call the public version, but instead Visual Studio errors out: error C2248: 'ClassA::Get' : cannot access protected member declared in class 'ClassA' When commenting out the protected overload and removing all references to it, the code compiles. Why does the