Last active
August 4, 2020 18:35
-
-
Save digitsensitive/00f67c1cb1675702a4d84053f65d8587 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
| export class SimpleEnemyFactory { | |
| public create(enemyType: string): Enemy { | |
| switch (enemyType) { | |
| case "bobbie": | |
| return new Bobbie(); | |
| case "wallace": | |
| return new Wallace(); | |
| case "kanye": | |
| return new Kanye(); | |
| default: | |
| // Oops, no Enemy of this type! | |
| break; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment