と書かれている以下のURLを見つけました。
If an operator can be used as either a unary or a binary
operator (&, *, +, and -), you can overload each use separately.
Linuxでg ++を使用していますが、次のことを試しましたが、コンパイルできませんでした。
int operator+ (const int a,const int b){
std::cout << "MINE"<<std::endl;
return 0;
}
int main(){
char c='c';
std::cout << c+2 << std::endl;
}
エラーは言う
error: ‘int operator+(int, int)’ must have an argument
of class or enumerated type
私は喜んでプレイし、整数昇格ルールの動作を見たいと思っていました。
何か間違ったことをしているのですか、それともその URL は MS に対してのみ有効ですか、それともプロモーション ルールを誤解していますか?