• 工廠方法模式:定義一個用于創(chuàng)建對象的接口,讓子類決定實例化哪一個類。工廠方法使一個類的實例化延遲到其子類。(Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses).
  • 工廠方法模式中,抽象產品類Product負責定義產品的共性,實現對事物最抽象的定義;Creator為抽象創(chuàng)建類,也就是抽象工廠,具體如何創(chuàng)建產品類是由具體的實現工廠ConcreteCreator完成的。類圖如下: