Chapter 8 Operator Overloading and Conversion Functions

Classes are useful for representing numeric data types that are not built into the language. This chapter covers two features of C++ that can make these classes behave more like the built-in types: operator overloading, which allows you to use operators with your classes, and conversion functions, which allow you to convert between classes.

This chapter covers the following topics:

Overloading operators as member functions

Overloading operators as friend functions

Constructors that perform conversions

Conversion operators