6 Smart pointers and polymorphism

This chapter covers

  • Using inheritance for dynamic polymorphism
  • Special member functions
  • Type traits
  • Using smart pointers
  • Random number distributions

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 ...

Get Learn C++ by Example 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.