Created
August 5, 2020 19:58
-
-
Save digitsensitive/c286f2aca27d7193361d654184395f45 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 abstract class PizzaFactory { | |
| protected abstract create(): Pizza; | |
| } | |
| export class ProsciuttoFactory extends PizzaFactory { | |
| public create(): Pizza { | |
| let pizza = new Pizza(); | |
| pizza.addIngredients([ tomatoes, mozzarella, ham, salt, oliveOil ]); | |
| return pizza; | |
| } | |
| } | |
| export class MargheritaFactory extends PizzaFactory { | |
| public create(): Pizza { | |
| let pizza = new Pizza(); | |
| pizza.addIngredients([ tomatoes, mozzarella, basil, salt, oliveOil ]); | |
| return pizza; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment