File tree Expand file tree Collapse file tree 3 files changed +7
-9
lines changed
Expand file tree Collapse file tree 3 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -177,7 +177,7 @@ package design.patterns.factory.method;
177177public abstract class AbstractFactory {
178178 public abstract IProduct createProduct ();
179179
180- public void doSomething () {
180+ public void pickProduct () {
181181 IProduct product = createProduct();
182182 System . out. println(" Do something with" + product. getType());
183183 }
@@ -223,14 +223,12 @@ public class MainTestFactory {
223223
224224 public static void main (String [] args ) {
225225 AbstractFactory factoryA = new FactoryA ();
226- factoryA. doSomething();
227-
228- AbstractFactory factoryB = new FactoryB ();
229- factoryB. doSomething();
230-
231- AbstractFactory factoryC = new FactoryC ();
232- factoryC. doSomething();
233-
226+ IProduct productA = factoryA. createProduct();
227+ factoryA. pickProduct();
228+
229+ AbstractFactory factoryA1 = new FactoryB ();
230+ IProduct productA1 = factoryA1. createProduct();
231+ factoryA1. pickProduct();
234232 }
235233
236234}
You can’t perform that action at this time.
0 commit comments