The factory method uses factories for creating
objects with no explicit need of identifying the exact class of object that
will be created. Typically the factory pattern leverages the inheritance
mechanism with the actual creation process delegated to subclasses. Factory is
frequently used for avoiding duplication of code and for abstracting common
functionalities. In this sense a superclass specifies generic behaviours by
using pure virtual placeholders for creation steps. Then the superclass
delegates the creation details to subclasses that are supplied by the client.
No comments:
Post a Comment