The information in this article applies to:
SYMPTOMSThe following warning may be generated when Microsoft C/C++ version 7.0 or later is used to compile a C++ source file that uses a class containing a const data member: where class_name is the name of the class containing the const data member. CAUSEThe compiler will generate an assignment operator function for a class that does not define one. This assignment operator is simply a memberwise copy of the data members of an object. Because const data items cannot be modified after initialization, if the class contains a const item, the default assignment operator would not work. RESOLUTIONThe C4512 warning will not prevent the generation of an object module. The warning can be eliminated by any of the following methods:
-or- -or- MORE INFORMATIONThe following sample C++ code demonstrates this situation. Sample Code
Additional query words: 8.00 8.00c 9.00 9.10
Keywords : kbCompiler kbCPPonly kbVC100 kbVC150 kbVC151 kbVC152 kbVC200 kbVC210 kbVC400 kbVC410 kbVC420 kbVC600 |
Last Reviewed: October 15, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |