In This Chapter
Introducing the assignment operator
Knowing why and when the assignment operator is necessary
Understanding similarities between the assignment operator and the copy constructor
Comparing copy semantics with move semantics
The intrinsic data types are built into the language, such as int, float, and double and the various pointer types. Chapters 3 and 4 describe the operators that C++ defines for the intrinsic data types. C++ enables the programmer to define the operators for classes that the programmer has created in addition to these intrinsic operators. This is called operator overloading.
Normally, operator overloading is optional and not attempted by beginning C++ programmers. A lot of experienced C++ programmers (including me) don’t think operator overloading is such a great idea either. However, you will have to learn how to overload one operator: the assignment operator.
An operator is nothing more than a built-in function with a peculiar syntax. The following ...