14.5. Subscript Operator
Classes that represent containers from which elements can be retrieved by position often define the subscript operator, operator[].
Exercises Section 14.4
Exercise 14.20: Define the addition and compound-assignment operators for your Sales_data class.
Exercise 14.21: Write the Sales_data operators so that + does the actual addition and += calls +. Discuss the disadvantages of this approach compared to the way these operators were defined in § 14.3 (p. 560) and § 14.4 (p. 564).
Exercise 14.22: Define a version of the assignment operator that can assign a string representing an ISBN to a Sales_data.
Exercise 14.23: Define an initializer_list assignment operator for your version of the StrVec class.
Exercise 14.24: Decide ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access