- Gof/FactoryMethod . . . . 14 matches
First we'll define factory methods in MazeGame for creating the maze, room, wall, and door objects:
class MazeGame {
Each factory method returns a maze component of a given type. MazeGame provides default implementations that return the simplest kinds of maze, rooms, walls, and doors.
Maze* MazeGame::CreateMaze () {
Different games can subclass MazeGame to specialize parts of the maze. MazeGame subclasses can redefine some or all of the factory methods to specify variations in products. For example, a BombedMazeGame can redefine the Room and Wall products to return the bombed varieties:
class BombedMazeGame : public MazeGame {
BombedMazeGame();
An EnchantedMazeGame variant might be defined like this:
class EnchantedMazeGame : public MazeGame {
EnchantedMazeGame();
Found 1 matching page out of 7555 total pages (5000 pages are searched)
You can also click here to search title.