コード例 #1
0
            static void Main(String[] args)
            {
                // Mobile Mother
                MobilePhone mbp = new MobilePhone();

                mbp.CallPersonMethod();
                mbp.PlayMusicMethod();
                mbp.PlayInternetMethod();
                mbp.TakeAPhotoMethod();
                mbp.GPSMap();

                // Iphone child
                IphoneMobile ipm = new IphoneMobile();

                ipm.PlayMusicMethod();
                ipm.TakeAPhotoMethod();
                ipm.Siri();

                // Samsung child
                SamsungMobile ssm = new SamsungMobile();

                ssm.CallPersonMethod();
                ssm.GPSMap();
                ssm.Drawing();
            }
コード例 #2
0
ファイル: MobileFactory.cs プロジェクト: cpopovici/internship
        public static SamsungMobile CreateSamsungMobile(string model, string processor, int ram)
        {
            string name   = "Samsung";
            var    mobile = new SamsungMobile(name, model, processor, ram);

            OnMobileCreated(mobile);
            return(mobile);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: cpopovici/internship
        static void Main(string[] args)
        {
            // Singleton usage example
            GameManager.Instance.LoadLevel(1);
            GameManager.Instance.NumberOfEnemies = 5;
            while (GameManager.Instance.NumberOfEnemies > 0)
            {
                GameManager.Instance.NumberOfEnemies--;
                Console.WriteLine("Killing one enemy! Remaining {0}", GameManager.Instance.NumberOfEnemies);
                GameManager.Instance.Score += 10;
                Thread.Sleep(200);
                if (GameManager.Instance.NumberOfEnemies == 0)
                {
                    GameManager.Instance.GameWin();
                }
            }

            Console.WriteLine("\nFactory Example:\n");
            // Factory example
            SamsungMobile samsung = MobileFactory.CreateSamsungMobile(model: "S10+", processor: "845", ram: 8192);
            XiaomiMobile  xiaomi  = MobileFactory.CreateXioamiMobile(model: "Mi Mix 3", processor: "855", ram: 6144);

            Console.ReadKey();
        }