error C4716: “operator<<”: 必须返回一个值
来源:互联网 发布:java的applet过时了吗 编辑:程序博客网 时间:2024/06/05 15:57
error C4716: “operator<<”: 必须返回一个值
#include <iostream>using namespace std;class Complex{public:Complex() {real=0;imag=0;}Complex(double r,double i){real=r;imag=i;}Complex operator+(Complex &c2);friend ostream& operator <<(ostream&,Complex&);private:double real;double imag;};Complex Complex::operator+(Complex &c2){return Complex(real+c2.real,imag+c2.imag);}ostream & operator <<(ostream &output,Complex &c){output<<"("<<c.real<<"+"<<c.imag<<"i"<<endl;return output; //loss this one will alarm, please pay attention}int main(){Complex c1(2,4),c2(6,10),c3;c3=c1+c2;cout<<c3;system("pause");return 0;}
0 0
- error C4716: “operator<<”: 必须返回一个值
- operator=返回一个reference to *this
- basic_istream::operator>>返回值为类本身
- 必须返回一个对象时,不要试图返回一个引用
- 条款10:令operator= 返回一个reference to *this
- 条款10:令operator= 返回一个reference to *this
- 条款10:令operator=返回一个reference to *this
- item10: 令operator=返回一个reference to *this
- 条款10:令operator = 返回一个reference to *this
- 条款10:令operator=返回一个reference to *this
- operator=为什么要返回一个reference to *this
- 条款10:令operator=返回一个reference to * this
- 条款10 令operator=返回一个reference to *this
- 条款10:令operator=返回一个reference to *this
- 条款10 令operator=返回一个 reference to *this
- effective c++ 令operator=返回一个reference to *this
- 令operator=返回一个reference to *this
- 令operator= 返回一个reference to this
- Activity,Window和View之间的关系
- 使用gulp-uglify压缩js文件
- 中国的“机器人革命”
- 编写具有可维护性的JavaScript代码
- C++常见gcc编译链接错误解决方法
- error C4716: “operator<<”: 必须返回一个值
- 学生信息管理系统
- UIView的clipsToBounds属性和CALayer的masksToBounds属性的比较
- Swift,语法入门学习
- Codeforces Round #197 (Div. 2) -- C. Xenia and Weights (DFS回溯)
- Spring 入门知识储备
- C#笔记_1-动态生成类,程序集
- blog myBlog = new blog()
- Street