You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: factory.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
We need to create objects without having to specify the exact class of the object that will be created.
5
5
6
6
## Solution
7
-
The **Factory** pattern is a specialization of the [Template](template.md) pattern. We start by creating a generic base class where we don't make the "which class" decision. Instead, whenever it needs to create a new object, it calls a method that is defined in a subclass. So, depending on the subclass we use (**factory**), we create objects of one class or another (**products**).
7
+
The **Factory** pattern is a specialization of the [Template](template_method.md) pattern. We start by creating a generic base class where we don't make the "which class" decision. Instead, whenever it needs to create a new object, it calls a method that is defined in a subclass. So, depending on the subclass we use (**factory**), we create objects of one class or another (**products**).
8
8
9
9
## Example
10
10
Imagine that you are asked to build a simulation of life in a pond that has plenty of ducks:
0 commit comments