摘要: 这两天在看设计模式,想在这边随便写点. 模式一.装饰者模式 Decorate 书中举的一个例子,就是卖咖啡的问题. 首先coffee 有好多种,摩卡,蓝山等等. 我们会定义一个基类class coffee { decimal cost(); } 然后派生两个类 class mocha : coffee { decimal cost(); } class blue : coffee... 阅读全文
posted @ 2008-05-23 11:05 alwaysdotnet 阅读(149) 评论(0) 推荐(0) 编辑