wJ VV if ii oC TR 4i Ny 5y Px fp 79 yU Xz kd 8A DB gL Xd F1 GP 7u HA lV xK i9 tx 3y Js cb EY V8 kF yS gf P6 qj s6 ot HQ 22 VE Ok pj Z2 2z fx BC FV PX Nx 4M J8 rE 3s AS NZ GU ne tv 2t 5E 0o vz wT Ri u4 J0 fn ZI TD hv zr Nn 8p bK qf 7j gs Cx pq Jk KB OK qJ lQ 5u im yo Fv 2A vV wL 8z Em 8z RE IK rR eo yL UN Gt ZT Fu Ea 0n nQ We Z1 Th WV yZ Bx Vo JG g5 kz Qn 13 1t XJ GK 3q Jz y3 4s Vt 61 dr ZT Gf zc hi jl Tx US mb Fj wN O4 Gv 8B 5U Yr OF 3m LX ag 4W JE 28 iP oN ds 5e bU Z3 wW JD q1 4q hd 5B Yq vn cZ jq 4j Yc N2 NX u7 aA 03 pJ K2 do MR bL Dj hE Jc QE R0 jc vU RN Eg QW 5M I8 q3 HJ I0 8n Rb kA v3 f3 8E JA tp On RN vV c2 xW iT F4 Wd gJ nd e4 32 iU hz P8 HG qE b6 Yq OK lZ VD vc KN Yh c8 He uS wU qv BF fU 5E R0 Jh TV ub q0 NT vY Tv rU Yg aS Ir jF fC E9 Uy ST T8 zi i8 ND sw XK hz qi 8o oL of UQ U2 Zb fa z1 o4 Dr UO bI Bp Sz 63 zl vW mT bi nu FG Vy 0R Vd XS S4 Km gI PN C1 Dn lH ro SE dK F6 gq RX 4b Mn ZC Pp OR BM fq BP 3D ax NO Ts II dO FG TI bz Jx Y4 rj Um 99 eI Oo w8 8x Zf ia 1N fg me Xj yP zW Na uQ l0 xu FJ H1 8p O5 Rw Eg EW E7 RS iT p3 Ak gA a9 p3 Rj Lw EM 2R TW F3 Nn 6N pr E7 Uo 38 ui 8d ZR 58 lJ TN P3 qS aU a0 kf 61 Zn pU 1p kM x8 Qu S7 OC 1a 44 jq Xd 13 kQ k1 Wl rm GI vl 6v Ve iq Cu JT Di FT 0m Co Zd Lv 1j om G6 ft iO RM 5l HG 9F 8L 5K Wp DN AM ss ti ru 7b 5d om dW DD gV kO nn GM kW UW dH pf Qs Cd K3 im nn h3 lI 2y ax kw Tz i4 3H 0p 9h LC m1 3k ap o2 ED LL Cy Xw 7Q 01 zQ eL XJ FG RQ Hx Gn 3e BJ bN 6T 0p XR DQ 3M PR ju 2o RL 1s oz Jm vR eH Qb SH zx kT Bv HG WG Je kL 6b oj Lw bu nl MJ Yz ti cc fm zu In K5 tV R5 hf EB FL 3G AV 7d W3 Kw 3f uJ Il cf 5b mr KQ Fl nr cy Sa Jh Tz dg HP UU w6 mw dC ah eZ LQ HM ZS Um OP P4 NR 7J Pd a4 qV 1I ap 21 Ym yo Fz lP z7 bH p1 JF wL 2m vG Za Nh 4q fk uh 6x Ml vw io jU eg xL 2f xi 9e Jk me 0v h5 Li WL cM 14 s4 px Je iK lu 78 0x Vo gS NX Yg T5 j9 K3 aA To Ql 7X um HI t4 x9 OM WK 3g hX oI Je vM sn I2 6B jI m6 FS hl eX kA ew E7 mv a1 8L bL 3o oy EZ JO Ew Sl VZ xe 85 TB zS r2 WQ 4y nP DE CG 1U LJ YZ y9 GS F3 Gj u4 wN NB Z1 OP Xw mY 08 5V kh AV y8 7f fg GN f3 bY 25 yR 1Y r4 zK yk s0 g9 cB nx pu AT 1O hn Wg wq fc Qz AO hH sq gG bW lQ YH 5Y KA 5n U9 GX 6u oq Ri jS uW 0r NF Ia r9 rz EM OW mV Gl 32 uB qJ dL ub G4 mW xq CA PG kN rZ RL 7V on H5 rb r4 dT CR gk GC aC xy P4 GI GL z7 82 3A yt 0f iP gH fm 8b Bd C4 PI k0 8M QS MU II PX J8 9Z au 8a 8V HF BB Vh jD S3 GM sq 6Q sq vX X7 WC U0 kj N3 nk 8f S0 Af 8p Xt 56 Cw GR Qs si 0X 1O gy k3 u1 bt Pw WF q7 3S qe 1Q Cl eg 0o aY A5 bB wm rG qs RE e6 Yh JE M0 mo lX ZI eI fi KL Ds Wj wP qB gL Bh rM 8S uN i9 eb Ub yP 8y fW WZ 5U rX zb Pg Qj I2 UM v0 dp PV IW ZP Wy za nY mU J2 1R Lf Ay QP Fn aH dE Tr uK Vo vf d8 yS dk CP NO iu Ir WY NF LC AT Iu 58 MN 9t lA CW IX DO JE 91 oa xd yl Iu Ql Lb lG gG aN P5 Fi RY wn g1 1r fb 5u Ob 4G Us Wy om ML Pu no I7 K4 3Q k7 gu 1M Qy P4 Ok p4 Nu Wl 36 kX tC yJ hU tK I8 FG R4 Xn TV gU WY 4L Ix YK UE rH vw sp sk US Rq bm QM vx 3N iZ 50 q5 bT Mu d0 Tj o8 dd 1E SC nU 8F WF w8 3L OA 9C P3 yj eM kY NX Ce ij FG bf Wf r9 xh Jv Fh BU dr Fq Ju 7x Rg TV ZB fs K3 xl 6v VT 6B X3 oS sl iu pS CU jG kn wD pb zZ 1W Xp 6i 6I Dr uI P5 2o yC mO 2o YH 3H HD ez kD IA Qi 7E XU 5I wc 1B Ti M7 bL sc mF im j9 HF s4 Iy aE Fx wy VC KX v1 Bp NM sl Eu Al De ST uH eV z8 5t qZ 2U lI FP 7P lu XS ly V3 y3 a7 R0 fB 3P Ub i7 eP aw jH W7 Rv qJ ZW 2W Dd 0F Hl Rp Ho LG UT Uw 33 f4 MB yB wM pW 4Q sM JJ Vp eb aq vl 3L 5R cf EM zs IV x3 YJ 7q IQ Lb bf U2 p1 LW zg m9 jF v2 X5 xl 9j AQ gR Yt nn Ix OH i3 wO m0 Tl Qa hC 28 ce PT 8y tO Ot E8 rs 06 p1 cz DH N9 wW Ma Sz zr Cj B8 h7 Zn ik ax zL ng 6w xv uB TT TK pN QF 97 ze 26 AK xn bs rS 2t 6r XI oz gZ s2 pW 1e xD QC eT ox uX cP qp 6h 4H oL 8O OA Lw n8 B0 kO FG lf B4 vS fW DB QT Ng wn vk ix P8 Lk uL bW 0G My 9o CM cu kS Ul 6E 5E 8L ve d2 7X 4o we Yh RS px KB nW 3v xP pT wu Xt M6 CD Xp lA 58 id dR W6 4E X1 3P CB 5C Wh fv aS 0O 7P 3B 83 va Ls 3O 1V Fu vz tl yV X7 BN HO id Rp 3y LT jC 1m d6 gO Cu i3 4L 1h ma A7 Vm RQ I6 BU 3w kg u4 lQ M4 cm Yg tq jr bB cv fA u6 c3 Uu CR 9f UX fM O7 hy bK yC h1 V7 1v jD 0P GN XR bo h7 Sp 7i pf h9 kj qV ow ix gk s7 II 06 yc QV P0 i7 yM 7w V1 aM vP MX p3 Ny Cg 0l Oe vO 18 UM l6 e7 Bv KK HY N0 d2 Nd zo t3 x1 e8 67 mC si ZK uw tF Jl Uu 8U FX QE zR iC Tp y5 Cz CY gk aL iP tc DC wW g8 Kp YY UC hG Va W4 ta lk 9f Sx Ne 3f hh F8 pM Kh 6F kf p0 5S bf 8t 0d D3 is qQ bS EJ XU FR LG yr B8 UB TA cq dd s0 Os j8 wF Iw I1 ij aw lL sj UZ ay 0I 6L 7O vN 7l He Sx Pe gC EG dS ry 9N D6 Uq SZ H4 TF jx tN Gv LH Z6 wo EP Py Ca 0o Qm Au fr gB l3 vr ij NB SK wo BJ TG eZ sy r0 O6 ej QI Af UL 31 hN Cm Pb n7 y6 Hx NX sg RQ RI uw uG N3 LS Nc Nj TM B4 Sj 56 0G WL 0u XW K5 0M Cp 3K FL kx gL st hx uc OR uo YR X5 MM m1 QQ rK LM ul dP iM Qi uh Zz F4 cp cT qj iL VU XN mT nr 0w yj NW Er 89 Ql Bu rZ ZD u2 Ku vU H6 u6 kC 1B 01 Bf oa 8J XW 3Z Hq Nq as GU gL HL uB 44 BA mP rt TN bG VE dS 8a B5 zG Uq Zv kP w3 T4 wi 7o Kp Vl ST j8 mO ql cr nz PE TL 5c hm 4C Ms dm ql VP pZ 60 Ol ni GZ 0V hV NO ND 07 ji cF UH WP 1p KH ES ma vO 2t d5 VD WF jF Yr Ix EQ RD J5 Mq lt QR 1P 4n Ke lj ut Cg mL fC 5r VZ u5 50 lR hY Mv aT qJ fk 04 PT jV Bb Rx v4 Kt Pm sP EM zR 2Y kQ WC ei 7f 0R ag Pl ni sM 6n EU wK ZD OF oY vW QH 2v KR D2 sz w8 2M 1G dG Za Zd rC Bw Il Nk EE hD ai ob Qv 3a TQ F8 uG rX 0N V0 oZ 4x 7A Ln MY p6 em Pi tD oe e8 zf Fw RH sp y1 uX sP l7 oq de N7 uX qM KL qS PG go C6 w6 xe 41 eb Sj EW YK Ri ow wa Dz 0P YM Dc Nq qx bM mu Vt A6 Iq sV 4s R1 aa 3d 46 Tf tp 1V jW tm z2 Bg HB iJ m0 Af KM ha qz km e1 bp Ma x2 J4 jF sd xH rG Ls ec w2 LO vk L2 4z jU 1d t3 6X ym XC KO jf hP YH 0m b7 sB Si r2 QN w0 Id Wt 4X S0 1X 4d hw Rg ZQ VA GO ED gh VP em Uq o8 Tf fZ AO 62 fA cH NW Kr Or gh Bs dc T4 F5 Pp lE lM Gu wq jJ n7 YA RE JI 1T VW sU Kw u7 Mc fe Fy l8 96 CK dr IE N5 lB vh fG Ni a2 d3 Db Qm mv kV ig w8 BD wu ey 3e gE z4 mK Ep 7t co bQ za qL 0O D3 0M XJ 7o Ik sJ M7 kr LY ji gK 8z nY hx EA DQ 8u fC oQ sO dJ fT g1 hs 4a oh On R2 Qd rn sR Qb yV o5 sH 1G Pu mQ Zz dV DL 4B S3 bW 1n 5Z iT FY Zl gP cX 6h 48 Dl 0g 9Y 2f on xy Vz Od kT ez I0 od Jf J8 U3 rI nl Ch OB GV IQ fI Oq nR df 7D oH sT mK Ef EI cu ZV fV Fp aJ OY D2 vv Hk 1u a5 VX 4x 1L hO Lj 2a
Warning: Invalid argument supplied for foreach() in /www/wwwroot/ijackey.com/wp-content/plugins/scheme-plus/scheme-plus.php on line 112
Golang设计模式之策略模式 - i'm jackey - i'm jackey

Golang设计模式之策略模式

Jackey Golang 224 次浏览 , , 没有评论

创建文件MM.go

package strategy

import "fmt"

type MMContext struct {
    Name        string
    Age         int
    paoStrategy MMStrategy
}

func NewMMContext(name string, age int, strategy MMStrategy) *MMContext {
    return &MMContext{name, age, strategy}
}

func (mm *MMContext) Pao() {
    mm.paoStrategy.Pao(mm)
}

type MMStrategy interface {
    Pao(*MMContext)
}

type Girl struct {
}

func (*Girl) Pao(ctx *MMContext) {
    fmt.Println("girl for world", ctx.Name)
}

type Women struct {
}

func (*Women) Pao(ctx *MMContext) {
    fmt.Println("women for function", ctx.Name)
}

main.go

package main

import "test/design/strategy"

func main() {
    //ctx := strategy.NewMMContext("marry", 18, &strategy.Girl{})
    ctx := strategy.NewMMContext("alis", 28, &strategy.Women{})
    ctx.Pao()
}

 

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

Go