Replace Constructor with Factory Method
From CSSEMediaWiki
(Difference between revisions)
(New page: When constructing a complex object or complex sets of objects, a Factory Method may be preferable to a Constructor when creating new objects. == See Also == {{Refactoring}}) |
|||
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. | + | 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 == | == See Also == | ||
{{Refactoring}} | {{Refactoring}} |
Revision as of 00:06, 15 October 2009
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