Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Weapon
- {
- private const int MinimumBullets = 0;
- private int _bullets;
- public bool CanShoot() => _bullets > MinimumBullets;
- public void Shoot()
- {
- if (CanShoot() == false)
- {
- throw new InvalidOperationException("Нет пуль.");
- }
- _bullets--;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement