From 605e39e09ee0716feaab108d1a73049332e79ee1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=BE=D1=80=D0=BE=D0=B7=D0=BE=D0=B2=20=D0=90=D0=BD?= =?UTF-8?q?=D0=B4=D1=80=D0=B5=D0=B9?= Date: Fri, 18 Mar 2022 11:36:55 +0000 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=B8?= =?UTF-8?q?=D0=BB(=D0=B0)=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D0=B2=20''?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- abstract_factory.dart | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/abstract_factory.dart b/abstract_factory.dart index 1131692..8189ed2 100644 --- a/abstract_factory.dart +++ b/abstract_factory.dart @@ -2,15 +2,15 @@ abstract class Drinkable { void pour(); } -class Beer implements Drinkable { +class Lemonade implements Drinkable { void pour() { - print("Pouring a delicious beer!"); + print("Пью холодный лемонад!"); } } class Coffee implements Drinkable { void pour() { - print("Pouring a refreshing coffee!"); + print("Пью горячий шоклад!"); } } @@ -19,9 +19,9 @@ abstract class DrinkFactory { DrinkFactory(); } -class Pub implements DrinkFactory { +class Cafe implements DrinkFactory { Drinkable createDrink() { - return Beer(); + return Lemonade(); } } @@ -32,24 +32,24 @@ class CoffeeShop implements DrinkFactory { } void main() { - var mood = "sleepy"; + var temperature = "cold"; late DrinkFactory destination; - switch (mood) { - case "sleepy": + switch (temperature) { + case "cold": destination = CoffeeShop(); break; - case "done": - destination = Pub(); + case "warm": + destination = Cafe(); break; default: - print("I only have two moods..."); + print("Мне ни холодно, ни жарко..."); } - var myBeverage = destination.createDrink(); - myBeverage.pour(); + var drinkable = destination.createDrink(); + drinkable.pour(); /* - Pouring a refreshing coffee! + Пью горячий шоклад! */ }