cxlove / DesignPattern

The example code from head first design patterns for practicing
0 stars 2 forks source link

The Factory Pattern using c++ #11

Open cxlove opened 8 years ago

cxlove commented 8 years ago

RT

cxlove commented 8 years ago

There is a problem in abstract factory part.

In pizza class, we need a ingredient factory to help us prepare corresponding material. So we can generate a factory in pizza store each time when we need create a new pizza and release it in pizza class. Also we can generate a factory when we create the pizza store, and always use this factory until we release the pizza store instance. Which is better.