In C ++, if a class has a reference data element, the default assignment operator is not synthesized by the compiler. Why?
What copy assignment should do is defined in:
C ++ 03 Standard 12.8 / 13:
Each subobject is assigned according to its type:
if the subobject has a class type, the instance assignment operator for the class is used (as if it were explicitly qualified, i.e. ignored any possible functions of virtual redefinition in more derived classes);
, ;
, .
,
,
?
:
, . , ++ , , , , .
:
++ 03 12.8/12:
, , . , , , :
.......
- ,
.......
[Ref 1]
++ 03 8.5.3/2:
. , , . (5.2.2) (6.6.3) .