Replace Constructor with Factory Method
From CSSEMediaWiki
(Difference between revisions)
m (Reverted edits by Ebybymic (Talk); changed back to last version by Matthew Harward) |
|||
Line 1: | Line 1: | ||
When constructing a complex object or complex sets of objects, a [[Factory Method]] may be preferable to a [[Constructor]] when creating new objects. This is particularly useful in the case of an inheritance hierarchy where the higher classes and other system classes should not have knowledge of which type of object to create. | When constructing a complex object or complex sets of objects, a [[Factory Method]] may be preferable to a [[Constructor]] when creating new objects. This is particularly useful in the case of an inheritance hierarchy where the higher classes and other system classes should not have knowledge of which type of object to create. | ||
− | + | == See Also == | |
{{Refactoring}} | {{Refactoring}} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Latest revision as of 03:23, 25 November 2010
When constructing a complex object or complex sets of objects, a Factory Method may be preferable to a Constructor when creating new objects. This is particularly useful in the case of an inheritance hierarchy where the higher classes and other system classes should not have knowledge of which type of object to create.
See Also