To see pretty girls, I don't know what to wear, so I will start to match them one by one. experiment with the best effect...
Package COM. WZS. design;/*** big talk design mode -- page53 decoration mode ** @ author administrator **/public class decorativepattern {public static void main (string [] ARGs) {person XC = new person ("coriander"); system. out. println ("first dress up:"); wearsneakers pqx = new wearsneakers (); // broken sneakers bigtrouser KK = new bigtrouser (); // pants tshirts dtx = new tshirts (); // large T-shirt pqx. decorate (XC); KK. decorate (pqx); dtx. decorate (kk); dtx. show (); system. out. PR Intln ("\ n type 2:"); wearleathershoes PX = new wearleathershoes (); // shoes wearsuit xz = new wearsuit (); // suit weartie LD = new weartie (); // tie PX. decorate (XC); lD. decorate (PX); xz. decorate (LD); xz. show () ;}/ ** person */class person {private string name; Public Person () {}public person (string name) {This. name = Name;} public void show () {system. out. print (name + "dress up. ") ;}}/** apparel */class finery extends person {priv Ate person;/** dress up */Public void decorate (person) {This. Person = person;} @ overridepublic void show () {If (null! = Person) {person. show () ;}}/ ** large T-shirt */class tshirts extends finery {@ overridepublic void show () {system. out. print ("big t-shirt"); super. show () ;}/ ** pants */class bigtrouser extends finery {@ overridepublic void show () {system. out. print ("Pants"); super. show () ;}/ ** broken sneakers */class wearsneakers extends finery {@ overridepublic void show () {system. out. print ("Broken sneakers"); super. show () ;}/ ** suit */class wearsuit extends finery {@ overridepublic void show () {system. out. print ("Suit"); super. show () ;}/ ** tie */class weartie extends finery {@ overridepublic void show () {system. out. print ("Tie"); super. show () ;}/ ** shoes */class wearleathershoes extends finery {@ overridepublic void show () {system. out. print ("Shoes"); super. show ();}}
Output result:
The first type of dress: Big T-shirt, slashes, sneakers, and pickles. The second type is the suit, tie, and shoes.