填空题

下面是复数类complex的定义,其中作为友元函数重载的运算符“--”的功能是将参数对象的实部减1,然后返回对该对象的引用:请补充完整。
class complex

private:
int real;
int imag;
public:
complex(int r=0,int i=0):real(r),imag(i)
void show()

cout<<real<<(imag<0"-":"+")<<imag<<’i’;

【15】

complex& operator--(complex &C)

c.real--;
return c;

【参考答案】

friend complex& operator--(complex&)