Putting all the pieces together
So far in this chapter, we have understood the subtleties of abstract classes, including pure virtual functions, and how to create interface classes using abstract classes and pure virtual functions. It is always important to see our code in action, with all its various components and their various nuances.
Let’s take a look at a more complex, full program example to fully illustrate abstract classes, implemented using pure virtual functions in C++. In this example, we will not further designate an abstract class as an interface class, but we will take the opportunity to collect related derived class types using a set of pointers of their abstract base class type. This example will be broken into many segments; the full program can be found in the following GitHub location:
#include <iostream> #include <iomanip...