编译器错误 C2831
“operator operator”不能有默认参数
只有三个运算符可以有默认参数:
Assignment =
左圆括号 (
以下示例生成 C2831:
// C2831.cpp
// compile with: /c
#define BINOP <=
class A {
public:
int i;
int operator BINOP(int x = 1) { // C2831
// try the following line instead
// int operator BINOP(int x) {
return i+x;
}
};