Position:Home>web development> Php tutorial: The adornment that Php designs mode introduction implement mode
Php tutorial: The adornment that Php designs mode introduction implement mode
From;  Author:Stand originally

Above paragraphs: " PHP designs mode introduction " mode of eleventh chapter representative

" PHP designs mode introduction " dozenth chapter is decorated implement mode

If you had pursued object-oriented Php development, although very short time is only perhaps,understood through this book a few, you can know, you can be changed through acceding or increase kind function, this is a of all object-oriented languages main character. If had put a Php that be in kind lack certain method, perhaps must want to add more functions to the method (glamour) , you perhaps can accede merely this kind will produce new this builds kind of — to go up in additional code.

But generation subclass always is not likelihood or it is appropriate. If You hope to change already the behavior of the object of initialization, how do you do? Or, you hope to accede a lot of kind behavior, how to change to do? Before one, when can depending on moving only, finish, of the likelihood when latter is apparent, but kind of — dread feeling that may cause generation to differ in great quantities.

Problem

The accretion that the code that how you organize you makes his OK and easy is basic or a few character that use rarely, is direct not additional code writes in you kind in-house?

Solution

Decorate implement the flexible program that mode offerred change subclass. Decorate implement the got-up object that mode allows you to issue trends in the condition that does not cause subclass amount to explode, add character.

When be used at a group of subclass, decorate implement mode is more useful. If you have gens subclass (from a father kind derive and come) , you need next accretion to using a case independently with subclass additional character, you can use adornment implement mode, repeat what measure with specific subclass number in order to avoid code to increase. See the following case, you are OK better understanding this kind of viewpoint. The consideration is built odd library is expressed in package conceptual “form” , the kind of the control that express sheet that over you need to want show for each you builds kind. This sort pursues OK following place show:

Select And TextInput kind it is package kind subclass. The package — that if you want,increases a “labeled” to carry tag inputs watch sheet to tell you the content that should input. Because any expresses Chandouke to be able to need to be labelled, you may resemble such acceding each particular package:


Previous12 Next