#include "Complex.h" bool Complex::operator== (const Complex& rhs) const { if (real_ == rhs.real_) return (imag_ == rhs.imag_); return (false); } bool Complex::operator< (const Complex& rhs) const { if (real_ == rhs.real_) return (imag_ < rhs.imag_); return (real_ < rhs.real_); } ostream& operator<< (ostream& ostr, const Complex& rhs) { ostr << rhs.real_ << "+" << rhs.imag_ << "i"; return ostr; } Complex operator+ (const Complex& lhs, const Complex& rhs) { return Complex (lhs.getReal() + rhs.getReal(), lhs.getImag() + rhs.getImag()); } bool operator!= (const Complex& lhs, const Complex& rhs) { if (lhs.getReal() == rhs.getReal()) return (lhs.getImag() != rhs.getImag()); return ( true ); } // Overload ++ as postfix and prefix Complex& Complex::operator++ () // prefix { real_ = real_ + 1; return *this; } Complex Complex::operator++ (int) // postfix { Complex temp (*this); real_ = real_ + 1; return temp; }