來自C++新手的另一個問題。'operator =='不匹配C++編譯錯誤
我收到一個編譯器錯誤「不匹配‘運算符==’」爲代碼
void swap(Team t1, Player p1, Team t2, Player p2){
Player new_t1[11];
Player new_t2[11];
for(int i=0; i<11; i++){
new_t1[i] = t1.get_player(i);
new_t2[i] = t2.get_player(i);
if(new_t1[i] == p1){
new_t1[i] = p2;
}
if(new_t2[i] == p2){
new_t2[i] = p1;
}
}
cout << "Players swapped.";
}
任何想法以下塊?
你有沒有實現的'運營商=='功能'Player'類? – littleadv 2012-04-13 22:22:15