operator overloading 

理论知识:

 操作符本质上也是一个函数运算符。即运算符重载也就是函数进行重载。 

  例如:

基础学习(二)

 函数外重载:这一种是非成员函数,(这里面是没有this指针)

inline complex

operator + (const complex&,const complex&y){

 return complex(reaal(x)+real(y),

    imag(x)+imag(y));

}








相关文章:

  • 2022-01-08
  • 2021-07-08
  • 2021-05-21
  • 2021-10-26
  • 2021-08-04
  • 2021-11-07
  • 2021-05-11
  • 2021-12-31
猜你喜欢
  • 2021-08-15
  • 2021-04-08
  • 2021-08-18
  • 2022-01-14
  • 2021-11-01
  • 2021-10-04
  • 2021-11-18
相关资源
相似解决方案