Review
We started the chapter with a simple inventory control example that used a StockItem class and an Inventory class, including a function called ReorderItem that can be called for an Inventory object to produce a reordering report. This function calls a Reorder function for each StockItem in its StockItem Vec to calculate the quantity of that StockItem to be ordered based on the desired and current stock.
Then we built on that StockItem class by adding an expiration date. Rather than copying all of the old code and class definitions, we made use of a concept that is essential to the full use of C++ for object-oriented programming — inheritance. Inheritance is a method of constructing one class (the derived class) by specifying how it differs ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access