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++.
We learned a tremendous amount in this section. We extended our understanding of Object-Oriented Programming by adding the last two primary principles of OOP to our knowledge; inheritance and polymorphism. We spent some time learning the syntax related to inheritance to build on the foundation we developed when discussing exceptions in the exceptions section. We also discussed different types of inheritance, such as public, protected, and private. Then we built upon our knowledge of inheritance and discussed the third primary principle of Object-Oriented Programming, polymorphism. Polymorphism, which means many forms in Greek, also allows us to use a pointer of a base class type for example, and point to an object of a derived class type. We can combine this with dynamic memory allocation and create objects of many different types at runtime. This gives us incredible power to create, add, and manipulate objects while the program is running. As a side topic, we also discussed a special user-defined type called enums, or enumerated types, that allow us to represent a finite set of special values. The most common form of enums you'll encounter represent named constants that correspond to integer values. We finished out this section with a short project extending our current Animal Farm project by adding a derived Cat class. Then we worked on a rather complex project involving a hierarchy of role-playing game character players. This helped to solidify our general software development skills by using what we know about user interaction, breaking complex problems into functions, encapsulation, inheritance, and polymorphism. So, this project was truly a significant collection of skills and knowledge that tested your abilities with C++ and problem solving in general. In the next section, we will discuss templates, the standard template library and some other valuable topics to increase your skills and make you a good, well-rounded C++ developer. Let's get going.