Compiler warning on “Effective C++”s method to avoid duplication in const and non-const member functions
问题 This question has been updated. Please review the code. The following code was compiled with VC++ Nov 2012 CTP. Scott Meyers' book " Effective C++ " recommend that we should use the method of to avoid duplication in const and non-const member functions. However, the following code cause a warning (level 1). Because WDK build tool treats warnings as errors, so the following code cannot be compiled successfully. Is there other better method? struct A { int n; A(int n) : n(n) {} int Get() const