Connect to:
http://www.9cbs.net/develop/Article/10935.shtm
The long history of high school tactics, that is, Singleton is the most bad, and the fastest and most direct tactics. Its feature is that all the balls are directly transmitted to high-middle, all the offensives have only one example. It is also a high middle front. The advantage of this method is simple and practical, and it is easy to expand multiplexing :) Re-use tactics still only one instance, and you can use it again. There is also a high-middle access method is strictly controlled, and it is not used to make the high school's static global waiting method, because it will pollute the namespace (that is, overall tactics). There is also a single high middle front is a real (not Virtual). The same multiple tactics will not become a polymorphic two high middle or three high-middle, the target is clear: CLASS high-middle {public: static High school * instance (); protected: high middle front (); private: static high middle front * _ instance;
High medium * high medium :: _ instance = 0;
High School * High Central :: Example () {IF (_ instance == 0) {_ instance = new high middle front;} return _ instance;}