Implementing Safe Polymorphism

Now that we have an overview of the structure of the classes we're designing, Figure 10.23 shows the interfaces for the worker classes UndatedStockItem and DatedStockItem.

Figure 10.23. Safe polymorphism: The UndatedStockItem and DatedStockItem interfaces for the polymorphic version of StockItem (code\itempi.h)
 class UndatedStockItem : public StockItem { public: UndatedStockItem(); UndatedStockItem(std::string Name, short InStock, short Price, short MinimumStock, short ReorderQuantity, std::string Distributor, std::string UPC); virtual bool CheckUPC(std::string UPC); virtual void DeductSaleFromInventory(short QuantitySold); virtual short GetInventory(); virtual std::string GetName(); virtual void Reorder(std::ostream& ...

Get C++: A Dialog Programming with the C++ Standard Library 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.