예제 #1
0
        static void Main(string[] args)
        {
            string text = "The quick brown fox jumps over the lazy dog";

            Console.WriteLine("Оригинал: {0}", text);
            StringPrinter strPr = new StringPrinter(new NCPrint());
            Console.Write("NCPrint: ");
            strPr.Print(text);

            strPr.strategy = new UCPrint();
            Console.Write("UCPrint: ");
            strPr.Print(text);

            strPr.strategy = new LCPrint();
            Console.Write("LCPrint: ");
            strPr.Print(text);

            Water water = new Water();
            water.Print();

            water.Heat();
            water.Heat();
            water.Heat();
            water.Print();

            water.Cool();
            water.Cool();
            water.Print();

            Console.ReadKey();
        }
예제 #2
0
 static void Main(string[] args)
 {
     StringPrinter printer = new StringPrinter(new UCPrint());
     Console.WriteLine(printer.Print());
     printer.Sp = new NCPrint();
     Console.WriteLine(printer.Print());
     printer.Sp = new LCPrint();
     Console.WriteLine(printer.Print());
     Water SomeWater=new Water(new LiquidWater());
     SomeWater.TempUP();
     SomeWater.TempUP();
     SomeWater.TempDown();
     SomeWater.TempDown();
     SomeWater.TempDown();
     Console.ReadLine();
 }