August 2012
Intermediate to advanced
976 pages
30h 17m
English
Just as a class controls how objects of that class are initialized, it also controls how objects of its class are assigned:
Sales_data trans, accum;trans = accum; // uses the Sales_data copy-assignment operator
As with the copy constructor, the compiler synthesizes a copy-assignment operator if the class does not define its own.
Before we look at the synthesized assignment operator, we need to know a bit about overloaded operators, which we cover in detail in Chapter 14.
Overloaded operators are functions that have the name operator followed by the symbol for the operator ...
Read now
Unlock full access