package factory func CreateCashAccept(t int) Casher { var cash Casher switch t { case 1: //正常 cash = new(CashNormal) case 2: //8折 cash = &CashRebate{moneyRebate: 0.8} case 3: //满300减50 cash = &CashReturn{moneyCondition: 300, moneyReturn: 50} default: } return cash }