예제 #1
0
 public static Santa CallSanta()
 {
     if (instance == null)
     {
         instance = new Santa();
     }
     return(instance);
 }
예제 #2
0
        static void Main(string[] args)
        {
            Santa santa = Santa.CallSanta();

            santa.CreatePack(
                new Sweet("SuperSweet", "Roshen", Sweet.SweetType.Chocolate),
                new Sweet("KitKat", "Sweets", Sweet.SweetType.Chocolate),
                new Sweet("Jelly", "Svitoch", Sweet.SweetType.Jelly),
                new Toy("Car", "Igroteko", "blue"),
                new Toy("TeddyBear", "ToyUp", "brown")
                );

            int edition = 10;

            for (int i = 0; i < edition; i++)
            {
                Console.WriteLine(santa.SendPack().ToString());
            }
        }