Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. class Soldier {
  2. handEquip(weapon) {
  3. this.equipedWeapon = weapon;
  4. }
  5. useHandEquipmentAgainst(enemy) {
  6. this.equipedWeapon.shoot(enemy);
  7. }
  8. }
  9.  
  10. class MachineGun {
  11. open(bottle) {
  12. alert('*Opening A Bottle With The Machine Gun*');
  13. }
  14. shoot(enemy) {
  15. alert('*Shooting The Machine Gun Against The Enemy*');
  16. }
  17. }
  18.  
  19. // ...
  20.  
  21. const john = new Soldier();
  22. john.handEquip(new MachineGun());
  23. john.useHandEquipmentAgainst(new Soldier());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement