Просто объявите конструктор копирования как
ComplexNumber( const ComplexNumber &NewComplexNumber);
^^^^^
В противном случае компилятор не может привязать непостоянную ссылку к временному значению, являющемуся результатом выражения
AnotherComplex + (or -) AgainAnotherComplex
, который вызывает любой из операторов
friend ComplexNumber operator+(const ComplexNumber Complex1, const ComplexNumber Complex2);
friend ComplexNumber operator-(const ComplexNumber Complex1, const ComplexNumber Complex2);
что в свою очередь должно быть объявлено как
friend ComplexNumber operator+(const ComplexNumber &Complex1, const ComplexNumber &Complex2);
friend ComplexNumber operator-(const ComplexNumber &Complex1, const ComplexNumber &Complex2);
то есть параметры должны ссылаться на типы.
И это определение оператора
bool ComplexNumber::operator!=(const ComplexNumber Complex)
{
if(RealPart != Complex.RealPart && ImaginaryPart != Complex.ImaginaryPart)
return true;
else if(RealPart != Complex.RealPart && (!(ImaginaryPart != Complex.ImaginaryPart)))
return true;
else if(ImaginaryPart != Complex.ImaginaryPart && (!(RealPart != Complex.RealPart)))
return true;
return false;
}
не имеет большого смысла.
Определите это как
bool ComplexNumber::operator!=(const ComplexNumber &Complex) const
{
return not( *this == Complex );
}
Обратите внимание на классификатор const
после списка параметров. Тот же классификатор, который нужно добавить к operator ==
.