设计模式桥接模式bridge.pptx

设计模式桥接模式bridge

设计模式(Design Pattern)问题(Problem)凭什么你的手机游戏我不能玩M品牌手机的游戏,N品牌不能玩不同品牌手机操作系统不同,软件不通用用程序模拟,N品牌手机,有一个游戏,运行游戏的程序如何写问题(Problem) static void Main(string[] args) { MobilePhoneNGame game = new MobilePhoneNGame(); game.Run(); Console.Read(); } class MobilePhoneNGame { public void Run() { Console.WriteLine(运行N品牌手机游戏); } }如果有一个M品牌手机,也有游戏可以运行,如何设计?问题(Problem)问题(Problem) class MobilePhoneGame { public virtual void Run() { } } class MobilePhoneNGame : MobilePhoneGame { public override void Run() { Console.WriteLine(运行N品牌手机游戏); } } class MobilePhoneMGame : MobilePhoneGame { public override void Run() { Console.Wri

文档评论(0)

1亿VIP精品文档

相关文档