In this chapter, we will work with classes again, but this time using inheritance. We will create various "Blob" classes. Our blobs will be able to move forward and backward. If we get our blobs in a line at the bottom of a virtual paper bag, we can set them off racing and see which blob escapes the paper bag first. Separately from practicing with classes, we can then claim and furthermore prove that we can code our way out of a paper bag, a skill all programmers should aim for.
We will start with a simple class hierarchy and create a blob that takes a step at a time. We will consider which special member functions we need when we use inheritance and use type traits to interrogate various member functions. We will use random numbers again, using various distributions to decide how big a step a blob takes. The randomness will make the race more exciting. By storing a blob in a smart pointer, we can keep various types of blobs in a vector. Their behavior will vary depending on the type of blob, giving us dynamic polymorphism. They can then race, and we can sit back, watch, and congratulate ourselves on coding our way out of a paper bag.