Step 1 of 8
Inheritance
A class can inherit from another, getting all its members, then add or change behaviour:
class Weapon {
public:
int damage = 10;
void describe() const { std::cout << damage << "\n"; }
};
class Rifle : public Weapon { // a Rifle IS-A Weapon
public:
int magazine = 30;
};
Rifle r;
r.damage = 36; // inherited
r.describe(); // inherited
Your turn: make Sniper inherit from Weapon and set the base part through the base constructor.