コード例 #1
0
ファイル: Santa.cs プロジェクト: yzghurovskyi/GoFPatternsLabs
 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());
            }
        }