标签:
From <<C++ primer>>
1 struct Sales_data { 2 // constructors added 3 Sales_data() = default; 4 Sales_data(const std::string &s): bookNo(s) { } 5 Sales_data(const std::string &s, unsigned n, double p): 6 bookNo(s), units_sold(n), revenue(p*n) { } 7 Sales_data(std::istream &); 8 //other members as before 9 std::string isbn() const { return bookNo; } 10 Sales_data& combine(const Sales_data&); 11 double avg_price() const; 12 std::string bookNo; 13 unsigned units_sold = 0; 14 double revenue = 0.0; 15 };
标签:
原文地址:http://www.cnblogs.com/sarah-zhang/p/5423227.html