Exemplo n.º 1
0
 static void MyTea(HotDrink xTea)
 {
     CupOfTea x = new CupOfTea("",0,"");
     x = (CupOfTea) xTea;
     x.AddMilk();
     x.Drink();
     x.Wash();
     Console.WriteLine("Цвет {0}",x.Color);
     Console.WriteLine("Объем {0}",x.Volume);
     Console.WriteLine("Тип листьев {0}",x.LeafType);
 }
Exemplo n.º 2
0
 static void Main(string[] args)
 {
     Console.WriteLine("1)New object CupOfCoffe\n2)New object CupOfTea");
     ProcessDelegate process;
     int i;
     do
     {
         i=Convert.ToInt32(Console.ReadLine());
     } while (i<1 || i>2);
     switch (i)
     {
         case 1:
         {
             CupOfCoffee xCoffee = new CupOfCoffee();
             process = new ProcessDelegate(MyCoffe);
             process(xCoffee);
         }
             break;
         case 2:
         {
             CupOfTea xTea = new CupOfTea("White",100,"Цейлон");
             process = new ProcessDelegate(MyTea);
             process(xTea);
         }
             break;
     }
     Console.ReadKey();
 }