Search code examples
c++variable-assignmentcopy-constructorassignment-operatorassign

What happens when I make a assignment to object which has copy constructor but no assignment operator?


What happens when I make a assignment to object which has copy constructor but no assignment operator?
Will it call compiler's assignment operator, performing memberwise copy?


Solution

  • The copy constructor plays no role in assignment, the default assignment operator will be called that'll do a bit-wise copy of built-in type members and call assignment operator on object members of class type.