コード例 #1
0
ファイル: Student.cs プロジェクト: ewin66/CSharp-Study
 public void PlayIPhone(iPhone lumia)
 {
     Console.WriteLine("This is {0} play {1}", this.Name, lumia.GetType());
     lumia.Brand();
     lumia.Call();
     lumia.Photo();
 }
コード例 #2
0
        public void TestCreatePhone()
        {
            GalaxyMini      phone   = new GalaxyMini();
            AbstractFactory samsung = new SamsungFactory();

            Assert.AreSame(phone.GetType(), samsung.createPhone().GetType());

            iPhone          applephone = new iPhone();
            AbstractFactory apple      = new AppleFactory();

            Assert.AreSame(applephone.GetType(), apple.createPhone().GetType());

            Lumia           nokiaphone = new Lumia();
            AbstractFactory nokia      = new NokiaFactory();

            Assert.AreSame(nokiaphone.GetType(), nokia.createPhone().GetType());
        }