c++高手帮我解答下着个 为什么老出着个错误
来源:百度知道 编辑:UC知道 时间:2024/06/06 03:35:52
#include <iostream>
using namespace std;
class A {
private:
public:
int a;
A(){a=0;}
A(int x){a=x;}
friend bool operator ==(A &,A &);
};
bool operator==(A &x,A &y) {
if(x.a==y.a)
return true;
else return false;
}
int main() {
A a(10);
A b(10);
cout<<(a==b);
return 0;
}
错误是 F:\vc6.0\MSDev98\MyProjects\fefddf\asdwwdwd.cpp(24) : error C2593: 'operator ==' is ambiguous
Error executing cl.exe.
我用的是 vc6.0
using namespace std;
class A {
private:
public:
int a;
A(){a=0;}
A(int x){a=x;}
friend bool operator ==(A &,A &);
};
bool operator==(A &x,A &y) {
if(x.a==y.a)
return true;
else return false;
}
int main() {
A a(10);
A b(10);
cout<<(a==b);
return 0;
}
错误是 F:\vc6.0\MSDev98\MyProjects\fefddf\asdwwdwd.cpp(24) : error C2593: 'operator ==' is ambiguous
Error executing cl.exe.
我用的是 vc6.0
#include <iostream.h>//加上.h
//using namespace std;//VC++中不要用using namespace std
class A {
private:
public:
int a;
A(){a=0;}
A(int x){a=x;}
friend bool operator ==(A &,A &);
};
bool operator==(A &x,A &y) {
if(x.a==y.a)
return true;
else return false;
}
int main() {
A a(10);
A b(10);
cout<<(a==b);
return 0;
}
请高手帮我解答下这个C语言问题 请C语言高手帮我解答一下 高手帮我解答 c语言,高手帮解答下 请高手为我解答 问道高手为我解答 高手请为我解答!!!!! 请高手帮我解答 请教高手,帮我解答! 英语高手帮我解答!