Inheritance and Polymorphism
The course is part of this learning path
This course is designed to enhance your object-oriented programming skills by focusing on two concepts: inheritance and polymorphism. We'll cover the key concepts and then put them to practice with a couple of demo projects towards the end of the course.
- Learn about base classes and derived classes and how they are related
- Understand how different base classes can be used to control how derived classes inherit data and behaviors from their base classes
- Understand the fundamentals of polymorphism
- Learn about enumerated types in C++
- Beginner coders, new to C++
- Developers looking to upskill by adding C++ to their CV
- College students and anyone studying C++
To get the most out of this course, you should have a basic understanding of the fundamentals of C++.
In this course, we have discussed many different topics. We previously developed skills with fundamental class design and construction, as well as getting a sneak peek into exceptions. We also recently discussed file input and output to help us persist our data for longer than our programs run. In this section, we will continue to build our Object-Oriented Programming skills. Specifically, we will increase our understanding of inheritance, which we met briefly in the exceptions section. We will cover base classes and derived classes and how they are related. We will learn that different base classes have access specifiers that could be used to control how derived classes inherit data and behaviors from their base classes. Then we will discuss polymorphism, the third and final of the three primary principles of Object-Oriented Programming. A lot of students and even seasoned developers are a little nervous about polymorphism and think that it is a difficult topic, but it's really not that difficult. Once you have a solid foundation understanding inheritance, and since you already understand pointers, it shouldn't be too difficult to understand. We will also discuss a side topic, enumerated types or enums to add another cool tool to our tool belt. We will use what we learn in this section to build two great programs at the end of the section. The first will be a fairly simple extension of a class that we work on throughout this section. We will extend an animal class with a cat class. The second will be much more challenging, and will test a lot of the skills you've learned throughout the course, both in terms of C++ and problem solving as well, a role-playing game character creation project. I'm thrilled you've made it this far, and I'm looking forward to sharing some important knowledge and skills with you in this section. So, without further ado, let's get started with inheritance.
John has a Ph.D. in Computer Science and is a professional software engineer and consultant, as well as a computer science university professor and department chair.