You are designing a fantasy role-playing game. Create a hierarchy of character classes using inheritance in C++. You already have a base class Character , and you need to derive classes like Wizard, Warrior, and Rogue.
Each derived class should have unique abilities and attributes:
character type (
wizard,warrior,rogue) - This is the same attribute for all (only the default value differs).signature action (
Wizard- spell,Warrior- sword, andRogue- drinking). The method must be reassigned from the base class.
For example:
- The wizard's method prints: "My superpower is spell";
- The warrior's method prints: "My superpower is sword";
- The rogue's method prints: "My superpower is drinking";
Here is the code for the Character class:
class Character{
private:
std::string name;
int age;
std::string charType;
public:
std::string printName();
int printAge();
std::string printType();
void printSuperPower();
void setName(std::string n);
void setAge(int a);
};You need to implement 3 classes with two attributes: printSuperPower and setCharType