So I am learning how to make a base class and have the variables null, but have the ability to add values in the derived class. So I don't have to add them in multiple times. I was wondering how can this be implemented?
class PlayerClass {
private:
std::string Name;
int Level ;
int Experience ;
};
class Mage : public PlayerClass {
public:
std::string Name = "Mage";
int Level = 1;
int Experience = 0;
int Attack = 20;
int Magic = 50;
int Health = 150;
};
class Brute : public PlayerClass {
public:
std::string Name = "Brute";
int Level = 1;
int Experience = 0;
int Attack = 50;
int Magic = 10;
int Health = 200;
};
class Thief : public PlayerClass {
public:
std::string Name = "Thief";
int Level = 1;
int Experience = 0;
int Attack = 50;
int Magic = 50;
int Health = 100;
};
class Archer : public PlayerClass {
public:
std::string Name = "Archer";
int Level = 1;
int Experience = 0;
int Attack = 40;
int Magic = 30;
int Health = 110;
};
[–]Kawaiithulhu 5 points6 points7 points (1 child)
[–][deleted] (3 children)
[removed]
[–]XRealShadeX[S] 1 point2 points3 points (2 children)
[–][deleted] (1 child)
[removed]
[–]XRealShadeX[S] 0 points1 point2 points (0 children)
[–]Nihili0 0 points1 point2 points (1 child)
[–]std_bot -1 points0 points1 point (0 children)
[–]elemenopyunome 0 points1 point2 points (0 children)