It is one of the special member functions, which means that a default version of it is generated automatically by the compiler if the programmer does not declare one.
[1] For example: The language permits an overloaded assignment operator to have an arbitrary return type (including void).
Also, the C++ Standard Library requires this behavior for some user-supplied types.
[2] When deep copies of objects have to be made, exception safety should be taken into consideration.
One way to achieve this when resource deallocation never fails is: However, if a no-fail (no-throw) swap function is available for all the member subobjects and the class provides a copy constructor and destructor (which it should do according to the rule of three), the most straightforward way to implement copy assignment is as follows:[3] C++ supports assignment between different classes, both via implicit copy constructor and assignment operator, if the destination instance class is the ancestor of the source instance class: Copying from ancestor to descendant objects, which could leave descendant's fields uninitialized, is not permitted.