
Lesson 16-3: Operator Overloading
Templates, Operator Overloading, and Exceptions | 417
Name __________________________________________ Date _______________________
Section _________________________________________
In Lesson 12-5, you worked with class Fraction. This lesson asks you to rewrite this class
using overloaded operators. Here is the original specification file.
// Header file Fraction.h declares class Fraction.
class Fraction
{
public:
Fraction Add(Fraction frac1) const;
// Pre: frac1 and self have been initialized.
// Post: self + frac1 is returned.
Fraction Sub(Fraction frac1) const;
// Pre: frac1 and self have been initialized.
// Post: self ...