摘要:
设计模式——桥模式需求从现实故事说起,长虹与海尔都是大的电视机生产商,都能够生产21英寸与37英寸的电视,这个问题应该如何建模呢?下面尝试使用继承关系实现: // 定义一个制造商接口 public interface IManufacturer { void ShowName(); } // 再定义一个电视接口 public interface ITV { void Produce(); } // 定义2个电视机子类 public class TV21inches : ITV // 21英寸电视机 { public void Produce() { Console.WriteLine(&quo
阅读全文
posted @ 2012-10-08 15:12
萨迦狐
阅读(152)
推荐(0)
编辑