64,641
社区成员
发帖
与我相关
我的任务
分享
class Cs
{
public:
int test()
{
return 1;
}
int test1()
{
return 10;
}
};
int test1()
{
return Cs().test() + Cs().test1();
}
class Cs
{
public:
int test()
{
return 2;
}
int test2()
{
return 20;
}
};
int test2()
{
return Cs().test() + Cs().test2();
}
#include <stdio.h>
#include <stdlib.h>
int test1();
int test2();
int main()
{
printf("%d %d\n", test1(), test2());
system("pause");
return 0;
}
假如一个项目中,两个人无意中写了两个重名的类,会发生什么情况,出现未定义行为?
标准或者编译器不可能解决所有问题,但它应该尽量避免出现不必要的问题,上面这个问题是否是标准或者编译器力所能及的?