大家帮忙看看,该程序的结尾返回值有什么意义?
该程序的结尾返回值有什么意义?std::istream& Sales_item::input(std::istream& in)
{
double price;
in >> isbn >> units_sold >> price;
//检验是否读入成功
if (in)
{
revenue = units_sold * price;
}
else
{
//读入失败:将对象复位为默认状态
units_sold = 0;
revenue = 0.0;
}
return in;
}