10. Operator Overloading; Class string

Objectives

In this chapter you’ll:

• Learn how operator overloading can help you craft valuable classes.

• Overload unary and binary operators.

• Convert objects from one class to another class.

• Use overloaded operators and additional features of the string class.

• Create PhoneNumber, Date and Array classes that provide overloaded operators.

• Perform dynamic memory allocation with new and delete.

• Use keyword explicit to indicate that a constructor cannot be used for implicit conversions.

• Experience a “light-bulb moment” when you’ll truly appreciate the elegance and beauty of the class concept.

Get C++11 for Programmers, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.