一个复数类的疑问!!
一个复数类的声明定义如下:
class complex{
public:
complex();
complex(double d, double c);
inline complex operator +(complex& s);
private:
double real;
double image;
};
inline complex complex::operator +(complex& s){
return complex(this->real+s.real, this->image+s.image);
}
请问:real,image不是私有数据吗?,为何能用s.real,s.image这样读取私有数据?