Last active
July 29, 2018 16:58
-
-
Save raulmoyareyes/44e62f61f3677cad44ca2ffdbcb45985 to your computer and use it in GitHub Desktop.
Dependency Inversion Principle
This file contains 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 Ingredient { | |
// implementation | |
} | |
class Milk extends Ingredient { | |
// implementation | |
} | |
class Beverage { | |
constructor(ingredient) { | |
this.ingredient = ingredient | |
} | |
cost() { | |
// calculate the cost | |
} | |
} | |
class Coffee extends Beverage { | |
cost() { | |
// calculate the cost | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment