|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include <iostream>
#include <string.h>
using namespace std;
class complex_add
{
public:
double real;
double fault;
complex_add();
complex_add(double r,double k);
complex_add operator + (complex_add&d);
~complex_add();
};
complex_add complex_add::complex_add operator+(complex_add &d)
{
complex_add c;
c.real=real+d.real;
c.fault=fault+d.fault;
return c;
}
complex_add::complex_add()
{
real=0;
fault=0;
}
complex_add::complex_add(double r,double k)
{
real=r;
fault=k;
}
complex_add::~complex_add()
{
cout<<"Is done"<<endl;
}
int main()
{
complex_add a(5,6),b(6,7),c;
c=a+b;
cout<<c.real<<" "<<c.fault<<endl;
}
这个请问为什么会有语法错误啊 水货一个 希望给位大神指导 谢谢
是在
complex_add complex_add::complex_add operator+(complex_add &d)
{
complex_add c;
c.real=real+d.real;
c.fault=fault+d.fault;
return c;
}这里出的错误 就一下 谢谢了
|
|