摘要: 适配器模式:将一个类的接口,转换成客户期望的另一个接口。适配器让原本借口不兼容的类可以合作无间。分为:类适配器——用到多继承 对象适配器——被改变者是以对象的方式被组合进适配器中的外观模式:定义了一个统一的接口,用来访问子系统中的一群接口。外观模式定义了一个搞成接口,让系统更容易使用。可以对一个系统实现一个以上的外观模式。系统出了能够提供统一的接口外,复杂的底层接口也是对用户可见的。要和装饰者模式进行区分:装饰者模式是对将一个对象包装以增加新的功能或者行为 阅读全文
posted @ 2011-03-03 22:10 记录点滴 阅读(203) 评论(0) 推荐(0)
摘要: void foo(ifstream ifs) {} // 编译出错void foo(ifstream& ifs) {} // 编译成功原因:stream不能被复制实现方法:Make the copy constructor and assignment operator private (like inthe "ios" example - remember members are private by default if youdeclare your class with "class"). If you write any constru 阅读全文
posted @ 2011-03-03 11:39 记录点滴 阅读(3132) 评论(0) 推荐(1)