符号重载返回值的问题
来源:8-4 运算符重载

MarcoLhc
2020-06-13
Complex &Complex::operator=(const Complex &x) {
cout << this << endl;
cout << “operator =” << endl;
if (this != &x) {
_real = x._real;
_image = x._image;
}
return *this;
}
听了两遍没听明白Complex &和Complex有什么区别,我打断点看c都是complex对象
写回答
1回答
-
quickzhao
2020-06-14
Complex& 和Complex的区别就是传值或返回值是否有对象的副本产生,这就是引用的作用。
30
相似问题