Football Tactics -> State of Players

zhaozj2021-02-11  214

Connect to:

http://www.9cbs.net/develop/read_article.asp?id=11330

When the player's status is determined according to the status of the player, you can use the State mode. The team is context, the player is State, the coach is a client. The advantage is to locate a specific state-related behavior and divide the behavior of different states; make status conversion display; and the player can be shared by multiple coaches. The code is as follows: Class team {public: team (); private: friend class player; void change status (player *); private: player * _ status;};

Class player {public: // All Operation protected: void changes (team *, player *);

Class players are not good: public player {public: static player * instance ();

Virtual void sitting in the cooling bench (team *);

The Class player is very good: public player {public: static player * instance ();

Virtual void debut debut (team *);

转载请注明原文地址:https://www.9cbs.com/read-5236.html

New Post(0)