April 2017
Beginner to intermediate
394 pages
9h 16m
English
Now that we have a completed Factory class, let's look at how we would use it. Since the goal of this class was to decouple our M5StageManager from our specific derived M5Stage classes, it makes sense that it will be used in the M5StageManager class:
class M5StageManager { public: //Lots of other stuff here... static void AddStage(M5StageTypes type, M5StageBuilder* builder); static void RemoveStage(M5StageTypes type); static void ClearStages(void); private: //Lots of other stuff here static M5StageFactory s_stageFactory; };
Since the factory will be private in the M5StageManager, we will add interface functions so the user can control the factory without knowing the implementation. This allows us to change ...
Read now
Unlock full access