예제 #1
0
        static void Main(string[] args)
        {
            var abtrfact = new Spartak();

            Console.WriteLine("Введите количество Киевских тортов, которое вам нужно");
            Console.Write("здесь: ");
            int a = Convert.ToInt32(Console.ReadLine());

            abtrfact.MakeCake(a).ForEach((a) => Console.WriteLine(a.Name));
            Console.WriteLine("Введите количество французских маффинов которое вам нужно");
            Console.Write("здесь: ");
            int b = Convert.ToInt32(Console.ReadLine());

            abtrfact.MakeMuffins(b).ForEach((b) => Console.WriteLine(b.Name));
            VeryBigCake v1 = VeryBigCake.getInstance();
            VeryBigCake v2 = VeryBigCake.getInstance();

            Builder  builder  = new CreamFirst();
            Director director = new Director(builder);

            director.Construct();
            Cream product = builder.GetResult();

            IConsigment consigment = new Prototype(14256);

            consigment.getInfo();
            IConsigment consigment1 = consigment.Clone();

            consigment1.getInfo();
            Console.ReadKey();
        }
예제 #2
0
 public static VeryBigCake getInstance()
 {
     if (instance == null)
     {
         lock (Locker)
         {
             if (instance == null)
             {
                 instance = new VeryBigCake();
                 Console.WriteLine("Мы испечем такой большой торт для Вас!");
             }
         }
     }
     else
     {
         Console.WriteLine("Такой торт уже испечен");
     }
     return(instance);
 }