摘要:
1.善用提供默认实参的构造函数,因为它能减少代码重复。举例:假设有如下构造函数1 class Sales_item { 2 public: 3 // default argument for book is the empty string 4 Sales_item(const std::string &book = ""): 5 isbn(book), units_sold(0), revenue(0.0) { } 6 Sales_item(std::istream &is); 7 ... 阅读全文
posted @ 2013-05-01 22:39
毋忆典藏
阅读(274)
评论(0)
推荐(0)