This Exploration continues the study of writing custom types. An important aspect of making a custom type behave seamlessly with built-in types is ensuring that the custom types support all the expected operators—arithmetic types must support arithmetic operators, readable and writable types must support I/O operators, and so on. Fortunately, C++ lets you overload operators in much the same manner as overloading functions.
Comparing Rational Numbers
In the previous Exploration, you began to write a rational type. After making a modification to it, an important step is testing the modified type, and an important ...