Article ID: 130486 - View products that this article applies to.
This article was previously published under Q130486
This article has been archived. It is offered "as is" and will no longer be updated.
When building an application that contains a base class with a pure virtual operator= function and a class derived from the base class with a defined operator= function, a following link error is generated for the base class's operator=:
This also occurs if the classes reside in a DLL and are declared with the __declspec( dllexport ) storage-class attribute.
error LNK2001: unresolved external symbol
In Visual C++ .NET you will receive the following error message:
LNK2019: unresolved external symbol
This behavior is by design. The assignment operator is not inherited. Normal inheritance rules do not apply, and declaring it pure virtual does not have the usual affect.
Since operator= is not inherited, any declaration of operator= in the base class is unused and unnecessary. Do not declare the operator= in the base class.
When built, the following code sample will generate the discussed LNK2001 error. Comment the declaration of the operator=() member in the base class to resolve.
Article ID: 130486 - Last Review: February 23, 2014 - Revision: 4.0