public static CashSuper CreatCash(string cashSort) { CashSuper cs = null; switch (cashSort) { case "正常": cs = new CashNormal(); break; case "满三百返一百": cs = new CashReturn(300,100); break; case "打0.8折": cs = new CashDisCount(0.8); break; } return cs; }
public static CashSuper CreateCashAccept(string type) { CashSuper cashSuper = null; switch (type) { case "正常收费": cashSuper = new CashNormal(); break; case "打折收费": cashSuper = new CashRebate(0.8); break; case "满减收费": cashSuper = new CashReturn(300, 100); break; } return(cashSuper); }
public CashContext(string type) { switch (type) { case "正常收费": CashNormal cs0 = new CashNormal(); cs = cs0; break; case "满300返100": CashReturn cs1 = new CashReturn("300", "100"); cs = cs1; break; case "打8折": CashRebate cs2 = new CashRebate("0.8"); cs = cs2; break; } }
public static CashSuper CreateCashAccept(string type) { CashSuper cs = null; switch (type) { case "正常收费": cs = new CashNormal(); break; case "满300返100": cs = new CashReturn("300", "100"); break; case "打8折": cs = new CashRebate("0.8"); break; default: break; } return(cs); }