输出流运算符的重载
output stream operator's overload
为什么输出流运算符的重载适用于此原型:
ostream &operator<<(ostream &flux, Complexe const & z);
不适合这个
ostream operator<<(ostream &flux, Complexe const & z);
您可以按值声明 operator<<
returns ostream
,但您可能无法定义它! ostream
有一个删除的复制构造函数和一个受保护的移动构造函数。
为什么输出流运算符的重载适用于此原型:
ostream &operator<<(ostream &flux, Complexe const & z);
不适合这个
ostream operator<<(ostream &flux, Complexe const & z);
您可以按值声明 operator<<
returns ostream
,但您可能无法定义它! ostream
有一个删除的复制构造函数和一个受保护的移动构造函数。