The information in this article applies to:
SUMMARYThe Microsoft "C++ Language Reference" for C/C++ version 7.0 states the following: ...if the class declares a user-defined operator=() that takes an argument of type "reference to class-name", no default assignment operator is generated.(See the Memberwise Assignment and Initialization section of the Special Member Functions chapter.) This statement may be confusing. However, the term "argument" means formal parameter, not actual parameter. MORE INFORMATION
The following program outputs "Default assignment used". The default
assignment operator is used for the assignment and not Derived::operator=()
as might be expected. The Derived::operator(const Base &) function
specifies a const Base & for a formal parameter. Because there is no
operator=() that specifies a formal parameter of type "reference to class-
name", the default assignment operator is generated and used.
Sample Code
Additional query words: 8.00 8.00c 9.00 9.10
Keywords : kbCompiler kbCPPonly kbVC100 kbVC150 kbVC151 kbVC152 kbVC200 kbVC210 kbVC400 kbVC500 kbVC600 |
Last Reviewed: July 10, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |