Introduction
Throughout Chapter 8, Classes and Structs and Chapter 9, Object-Oriented Principles we covered object-oriented principles in C++. We started by looking at classes and structs, creating our own user-defined objects to encapsulate our members. We then moved on to some basic object-oriented principles.
In this chapter, we're going to tackle some of the more advanced concepts of object-oriented programming (OOP), such as inheritance, virtual member functions, abstract classes, polymorphism, and casting between types. With an understanding of these principles, we can really start making use of the great features that make C++ the versatile and powerful language it is.
We'll start by looking at inheritance, a feature through which we can define common functionality in a single base class, then extend it in unique child classes; this is one of the fundamental concepts in OOP. This will lead us on to looking at virtual member functions. These allow us to define...