Content deleted Content added
→Notes: Correct author names, book title, and publisher for Note 2. |
DuncanHill (talk | contribs) Fixing harv/sfn errors. Please watchlist Category:Harv and Sfn no-target errors and install User:Trappist the monk/HarvErrors.js to help you spot such errors when reading and editing. |
||
Line 1:
{{Short description|Object-oriented software design pattern}}
In [[object-oriented programming]], the '''factory method pattern''' is a [[software design pattern|design pattern]] that uses factory methods to deal with the problem of [[object creation|creating objects]] without having to specify their exact [[class (computer programming)|classes]]. Rather than by calling a [[Constructor (object-oriented programming)|constructor]], this is accomplished by invoking a factory method to create an object. Factory methods can be specified in an [[Interface (object-oriented programming)|interface]] and implemented by subclasses or implemented in a base class and optionally [[method overriding|overridden]] by subclasses. It is one of the 23 classic design patterns described in the book ''[[Design Patterns]]'' (often referred to as the "Gang of Four" or simply "GoF") and is subcategorized as a [[creational pattern]].{{sfn|Gamma|Helm|Johnson|Vlissides|
==Overview==
Line 27:
== Examples ==
This C++14 implementation is based on the pre C++98 implementation in the book.{{sfn|Gamma|Helm|Johnson|Vlissides|
<syntaxhighlight lang="c++">
#include <iostream>
|