Article ID: 149324 - Last Review: July 5, 2005 - Revision: 1.1 FIX: Modifying Const Temporary Object Doesn't Generate ErrorThis article was previously published under Q149324 On This PageSYMPTOMS
The compiler generates the following error when you invoke a non-const
member function on a const object:
error C2662: 'Set' : cannot convert 'this' pointer from 'const struct
A *' to 'struct A *const '
RESOLUTION
To work around this problem, make the function return a reference to const.
STATUSThis bug was corrected in Microsoft Visual C++, version 6.0. MORE INFORMATIONSample CodeAPPLIES TO
| Article Translations
|

Back to the top
