http://www.cs.unc.edu/~stotts/GOF/hires/pat3cfso.htm
CreateMaze
is the function which instantiates the objects. IMO, according to factory pattern we are not supposed to overload or modify or re-write the function which instantiates objects.
But in the example, the CreateMaze function returns a Maze*. So, now if we have to write an EnchangedMaze class, will we have to re-write CreateMaze function to return a pointer of EnchantedMaze?
From: http://www.cs.unc.edu/~stotts/GOF/hires/chap3fso.htm
Changing the layout means changing this member function, either by overriding it—which means reimplementing the whole thing—or by changing parts of it—which is error-prone and doesn't promote reuse.
Isn't this what factory pattern wants to avoid?
What point am I missing?