August 2012
Intermediate to advanced
976 pages
30h 17m
English
Sales_data TypeAlthough we can’t yet write our Sales_item class, we can write a more concrete class that groups the same data elements. Our strategy for using this class is that users will be able to access the data elements directly and must implement needed operations for themselves.
Because our data structure does not support any operations, we’ll name our version Sales_data to distinguish it from Sales_item. We’ll define our class as follows:
struct Sales_data { std::string bookNo; unsigned units_sold = 0; double revenue = 0.0;};
Our class begins with the keyword struct
, followed by the name of the class and ...
Read now
Unlock full access