求助大虾 语法错误
#include<iostream.h>#include<iomanip.h>
class point
{
int x,y;
public:
point(int a,int b)
{
x=a;y=b;
}
void set(int a,int b)
{
x=a;y=b;
}
friend point operator + (point & a,point & b)
{
point c;
c.set(a.x+b.x,a.y+b.y);
return c;
}
void print()
{
cout<<x<<endl<<endl;
}
};
void main()
{
point a(23,25),b(1,2);
(a+b).print();
}
编译后显示:
-------------------Configuration: q - Win32 Debug--------------------
Compiling...
q.cpp
E:\vc++\q\q.cpp(19) : error C2512: 'point' : no appropriate default constructor available
Error executing cl.exe.
q.obj - 1 error(s), 0 warning(s)
希望各位大虾回一下!!!
[[it] 本帖最后由 步兵 于 2008-11-15 23:18 编辑 [/it]]