Chapter 22
A New Assignment Operator, Should You Decide to Accept It
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.
Comparing Operators with Functions
An operator is nothing more than a built-in function with a peculiar syntax. The following ...
Get C++ For Dummies, 7th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.