Claiming an Inheritance
Now let's examine the details of the part of this inventory control program that calculates how much of each item has to be ordered to refill the stock. As I mentioned previously, I've chosen the imaginative name ReorderItems for the member function in the Inventory class that will perform this operation. The ReorderItems function is pretty simple. Its behavior can be described as follows:
For each element in the StockItem vector in the Inventory object, call its member function Reorder to generate an order if that StockItem object needs to be reordered.
Of course, this algorithm is much simpler than what we would need in the real world; however, it's realistic enough to be useful in illustrating important issues in ...
Get Learning to Program in C++ now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.