ostream& operator <<(ostream& osObject, const storageRentals& rentals)
{
osObject << rentals.summaryReport();
return osObject;
}
summaryReport()
はvoid関数であり、それは私にエラーを与えている:は、<<のstd演算子のオーバーロード:: ostreamに
no operator "<<" matches these operands
が、私はANにsummaryReport
機能を変更した場合、エラーはありませんint
しかし、私が持っている問題は、値を返さなければならず、画面上にそれを印刷しているということです。
void storageRentals::summaryReport() const
{
for (int count = 0; count < 8; count++)
cout << "Unit: " << count + 1 << " " << stoUnits[count] << endl;
}
cout <<
にvoid機能をオーバーロードする方法はありますか?