I have a class named Creature with 3 protected variables: string name, int quantity and string type. I have two derived classes Phoenix and Basilisk.
I tried redefining some of the variables inside each derived class, so that it becomes that value for that derived class only, but I get these errors for each line I try redefine a variable.
Error C2059 syntax error: '='
Error C2238 unexpected token(s) preceding ';'
class Creature {
protected:
string name;
int quantity;
string type;
};
class Phoenix : public Creature {
Creature::type = "phoenix";
};
class Basilisk : public Creature {
Creature::type = "basilisk";
Creature::quantity = 1;
};