From the course: Object-Oriented Programming with C++
Unlock this course with a free trial
Join today to access over 24,500 courses taught by industry experts.
Challenge: Superhero ability system - C++ Tutorial
From the course: Object-Oriented Programming with C++
Challenge: Superhero ability system
(upbeat music) - [Instructor] In this module, we covered virtual functions, runtime polymorphism through virtual tables, virtual disruptors, and abstract classes with pure virtual functions. Let's practice these concepts by building superhero ability system. Here's the starter project in Chapter 4 04_06/end folder. We have an abstract ability class with a pure virtual function use, and a virtual function member describe. The class also declares a protected ability name member variable and the constructor. The implementation is pretty minimalistic. We also have three derived ability types that need your attention. Defensive ability, melee attack, and ranged attack. These classes are incomplete. I've added to-dos in their source code to provide hints about what's missing. Your task is to add the missing implementation and build the demo without issues. When completed, running the main code should produce the following output. Now here are some implementation hints. Enhance the base…
Contents
-
-
-
-
-
-
(Locked)
The many faces of objects3m 22s
-
(Locked)
Virtual functions: The basics2m 32s
-
(Locked)
Runtime polymorphism4m 33s
-
(Locked)
Pure virtual functions and abstract classes2m 7s
-
(Locked)
Virtual destructors: Why, when, and how6m 27s
-
(Locked)
Challenge: Superhero ability system1m 58s
-
(Locked)
Solution: Superhero ability system2m 16s
-
(Locked)
-
-