摘要: 代理模式和装饰器模式很像,这里用【到咖啡馆喝咖啡】作例子来讲解。 基础实现 定义一个咖啡的接口。 public interface Coffee { /** * 打印当前咖啡里有什么 */ void printMaterial(); } 定义一个苦咖啡的实现。 public class Bitter 阅读全文
posted @ 2019-09-02 15:03 GLORY-HOPE 阅读(255) 评论(0) 推荐(0) 编辑