// /// <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(); }
public void PlayPhone(AbstractPhone phone) { Console.WriteLine("这里是{0}", this.Name); phone.Call(); phone.Text(); }