The information in this article applies to:
SUMMARYNeither the error message itself nor the online documentation for the C2354 compiler error clearly specify the cause of this error:
MORE INFORMATIONIt is illegal to initialize a reference member of a class in the class's constructor with a temporary variable. An attempt to do so generates the C2354 error, as illustrated by this sample code: Sample Code
When this error is encountered, the solution is to change the code so that
the reference member is not initialized to a temporary variable. The
reference must be initialized to an object that will exist for the lifetime
of the reference member.
Additional query words:
Keywords : kbdocerr kbCompiler kbCPPonly kbVC200 kbVC210 kbVC220 kbVC400 kbVC410 kbVC420 kbVC500 kbVC600 kbOLDocs |
Last Reviewed: July 1, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |