August 2012
Intermediate to advanced
976 pages
30h 17m
English
Sales_data ClassUltimately, we want Sales_data to support the same set of operations as the Sales_item class. The Sales_item class had one member function (§ 1.5.2, p. 23), named isbn, and supported the +, =, +=, <<, and >> operators.
We’ll learn how to define our own operators in Chapter 14. For now, we’ll define ordinary (named) functions for these operations. For reasons that we will explain in § 14.1 (p. 555), the functions that do addition and IO will not be members of Sales_data. Instead, we’ll define those functions as ordinary functions. The function that handles compound assignment will be a member, and for reasons ...
Read now
Unlock full access