10.15 Wrap-Up
In this chapter, you learned how to overload operators to work with class objects. We demonstrated standard C++ class string
, which makes extensive use of overloaded operators to create a robust, reusable class that can replace C strings. Next, we discussed several restrictions that the C++ standard places on overloaded operators. We then presented a PhoneNumber
class that overloaded operators << and >> to conveniently output and input phone numbers, respectively. You also saw a Date
class that overloaded the prefix and postfix increment (++) operators and we showed a special syntax that’s required to differentiate between the prefix and postfix versions of the increment (++
) operator.
Next, we introduced the concept of dynamic ...
Get C++ How to Program, 10/e 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.