Skip to content

Latest commit

 

History

History
15 lines (8 loc) · 625 Bytes

13.6.md

File metadata and controls

15 lines (8 loc) · 625 Bytes

What is a copy-assignment operator?

A copy-assignment operator is the = operator used to control how objects of its class are assigned.

When is this operator used?

It is used when we assign value to an object.

What does the synthesized copy-assignment operator do?

It disallows assignment for some classes. Otherwise, it assigns each nonstatic member of the right-hand object to the corresponding member of the left-hand object using the copy-assignment operator for the type of that member.

When is it synthesized?

The compiler synthesizes a copy-assignment operator if the class does not define its own.