标签:include return double revenue
曾在2.6.2节的联系(第67页)中编写一个Sales_data类,请向这个类添加combine和isbn成员.
#ifndef SALES_DATA_H #define SALES_DATA_H #include <string> struct Sales_data { std::string isbn() const {return bookNo;} Sales_data& combine(const Sales_data&); unsigned units_sold=0; double revenue=0.0; std::string bookNo; }; Sales_data& Sales_data::combine(const Sales_data &rhs) { units_sold+=rhs.units_sold; revenue+=rhs.revenue; return *this; } #endif // SALES_DATA_H
本文出自 “奔跑的驴” 博客,请务必保留此出处http://amgodchan.blog.51cto.com/9521586/1568004
标签:include return double revenue
原文地址:http://amgodchan.blog.51cto.com/9521586/1568004