Connect to:
http://www.9cbs.net/develop/read_article.asp?id=11056
This is the basic construction of the team. In order to form a good national team, there are thousands of outstanding players in China, and each person's characteristics are different, and they must form a 11-person outstanding team, must follow 442 The formation of the stringent is divided into the division of each team, such as the front waist, the back, left front, and right guard, etc. This can make each position to enjoy a group, that is, Flyweight, prevent a large amount of too many objects, hindering the stability of the team's formation, also overhead, difficult to maintain. The code is as follows: Class location {public: virtual ~ position (); Virtual VoID kick (team *); protected: position ();}
Class specific location: public position {public: specific location ();
Virtual void kick (team *); private: char _ jersey number;
Class location factory {public: location factory (); Virtual ~ position factory (); Virtual specific location * Create a specific location (char); private: specific location * _ specific location (maximum jersey number);
Location Factory :: Location Factory () {for (INT I = 0; i Specific location * Location factory :: Create a specific location (CHAR jersey) {ix (! _ Specific location) {_ specific location (jersey number) = New specific location (jersey number);}