Conclusion

In this chapter, we defined a StockItem class and then extended the functionality provided in that class by deriving a new class, DatedStockItem, based on StockItem.

However, we have not yet seen how objects of these two classes can be used interchangeably. Although we can use base class pointers to point to objects of both base and derived types, we can't yet arrange for the correct function to be called based on the actual type of the object to which the pointer refers. In Chapter 10, we will see how to overcome this barrier.

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.