C++リロードオペレータの疑問
C++の高度なプログラミングの本によると、オペレータを次のように再ロードすることができますが、コンパイル中にエラーが発生しました.
コンパイルエラーは次のとおりです.
大体0つか1つのパラメータしかないと言っていますが、なぜか分かりません.の
friend const SpreadsheetCell& operator+(const SpreadsheetCell& rth, const SpreadsheetCell& lth);
const SpreadsheetCell SpreadsheetCell::operator +(const SpreadsheetCell& rhs, const SpreadsheetCell& lhs)
{
SpreadsheetCell newCell;
newCell.set(lhs.mValue + rhs.mValue);
return (newCell);
}
コンパイルエラーは次のとおりです.
G:\qt\sheet-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK____\..\Sheet\SpreadsheetCell.cpp:45: :'const SpreadsheetCell SpreadsheetCell::operator+(const SpreadsheetCell&, const SpreadsheetCell&)' must take either zero or one argument
大体0つか1つのパラメータしかないと言っていますが、なぜか分かりません.の