++ 且不用添加参数 特殊形式
{
Complex temp = *this;
_real++;
_image++;
return temp;
}
Complex operator--() //前置--
{
_real--;
_image--;
return *this;
}
Complex operator--(int) //后置--
{
Complex temp = *this;
_real--;
_image--;
return temp;
}
void Display() //显示复数的实部和虚部
{
cout << "real:" << _real << endl;
cout << "image:" << _image << endl;
}
private:
int _real;
int _image;
};
"Complex.cpp"
#include"Complex.h"
int main()
{
Complex d1(5, 10);
Complex d2(7, 10);
Complex d4;
cout << "d1(5,10) "<<"d2(7,10) "<<"d4(0,0)"<