Last active
July 26, 2019 11:16
-
-
Save nafidurmus/1d8b555c97a55614336c465729ca68db to your computer and use it in GitHub Desktop.
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 RestaurantServer | |
def initialize(meal_factory) | |
@meal_factory = meal_factory | |
end | |
def serve! | |
@meal_factory.new_utensil | |
@meal_factory.new_dish | |
end | |
end | |
class SushiMealFactory | |
def new_dish | |
MaguroSashimi.new | |
end | |
def new_utensil | |
Chopsticks.new | |
end | |
end | |
class SteakMealFactory | |
def new_dish | |
FiletMignon.new | |
end | |
def new_utensil | |
Knife.new | |
end | |
end | |
#kullanımı | |
meal_factory = SushiMealFactory.new | |
restaurant_server = RestaurantServer.new(meal_factory) | |
restaurant_server.serve! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment