operator overloading
理论知识:
操作符本质上也是一个函数运算符。即运算符重载也就是函数进行重载。
例如:
函数外重载:这一种是非成员函数,(这里面是没有this指针)
inline complex
operator + (const complex&,const complex&y){
return complex(reaal(x)+real(y),
imag(x)+imag(y));
}
operator overloading
理论知识:
操作符本质上也是一个函数运算符。即运算符重载也就是函数进行重载。
例如:
函数外重载:这一种是非成员函数,(这里面是没有this指针)
inline complex
operator + (const complex&,const complex&y){
return complex(reaal(x)+real(y),
imag(x)+imag(y));
}