Пример #1
0
        //public void Play<T>(T t) where T:
        //{
        //    Console.WriteLine("This is {0} play {1}", this.Name, lumia.GetType());
        //    t.Brand();
        //    t.Call();
        //    t.Photo();
        //}

        public void PlayPhone(BasePhone phone)
        {
            Console.WriteLine("This is {0} play {1}", this.Name, phone.GetType());
            phone.Brand();
            phone.Call();
            phone.Photo();
        }
Пример #2
0
        /// <summary>
        /// 面向抽象:只能用抽象里面的东西,只能如此
        /// 如果有个性化操作,那就别用抽象了,因为没有意义
        /// </summary>
        /// <param name="phone"></param>
        public void User(BasePhone phone)
        {
            Console.WriteLine("******************");
            phone.Call();
            phone.Text();
            //phone.Video();

            //Game game = new Game();
            //phone.Game(game);//苹果手机专有的
        }