Ejemplo n.º 1
0
        //  /// <summary>
        //  /// 依赖Iphone
        //  /// </summary>
        //  /// <param name="phone"></param>
        //  public void PlayIphone(Iphone phone)
        //  {
        //      phone.Call();
        //      phone.Text();
        //  }

        //  public void PlayLumia(Lumia phone)
        //  {
        //      phone.Call();
        //      phone.Text();
        //  }

        /// <summary>
        /// 依赖抽象
        /// </summary>
        /// <param name="phone"></param>
        public void Play(AbstractPhone phone)
        {
            phone.Call();
            phone.Text();
        }
Ejemplo n.º 2
0
 public void PlayPhone(AbstractPhone phone)
 {
     Console.WriteLine("这里是{0}", this.Name);
     phone.Call();
     phone.Text();
 }