Step 1 of 9
Member functions
In C++ a struct can contain functions as well as data. Inside a member function, members can be used directly:
struct Player {
int hp = 100; // default member value
void take_damage(int d) { hp -= d; }
bool alive() { return hp > 0; }
};
Player p;
p.take_damage(40);
Your turn: complete the member function reload so it refills ammo to mag_size.