Last active
August 10, 2021 11:26
-
-
Save carlosrojaso/3519bb367d94e4410bdd822b76295bea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Soldier { | |
constructor(level) { | |
this.level = level; | |
} | |
attack() { | |
return this.level * 1; | |
} | |
} | |
class SuperSoldier { | |
constructor(level) { | |
this.level = level; | |
} | |
attackWithShield() { | |
return this.level * 10; | |
} | |
} | |
class SoldierAdapter { | |
constructor(superSoldier) { | |
this.superSoldier = superSoldier; | |
} | |
attack() { | |
return this.superSoldier.attackWithShield(); | |
} | |
} | |
export { Soldier, SuperSoldier, SoldierAdapter }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment