學習設計模式 - 策略模式

策略模式 一、定義    定義一組算法,將每個算法都封裝起來,並且使它們之前可以相互轉換。(Define a family of algorithms, encapsulate each one, and make them interchangeable.)    二、理解    單獨抽取獨自變化的行爲,定義相應接口,實現並封裝對應的行爲,使得它們可以相互替換。      1. Context上
相關文章
相關標籤/搜索