Drama says command mode in Java design mode

xiaoxiao2021-03-06  39

Java design pattern I think everyone knows, but everyone's understanding is not the same, I just explain my point of view, if you don't give you your valuable comments different from your point of view. In order to clear the command mode, I want to give a deep example of everyone so that everyone's understanding, then the example borrowed the football example. UML slightly I designed five classes, namely the team owner, the boss's command (interface), the coach, the content, the player. Sample code of the player Public Class player {public void run () {race on the field;} public void norun () {Stadium no running;} public void shot () {shooting; Public void hoo () {active game;}}} Coach class code code PUBLIC CLASS commands The contents of the IMplements boss {player Team; public command content (player Ateam) {this.team = aAm;

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

New Post(0)