public GumballMachineContext(uint numBalls = 0) { _quartersController = new QuartersController(MaxQuartersLimit); _count = numBalls; _soldState = new SoldState(this); _soldOutState = new SoldOutState(this); _noQuarterState = new NoQuarterState(this); _hasQuarterState = new HasQuarterState(this); _state = (_count > 0) ? _noQuarterState : (IState)_soldOutState; }
public GumballMachine(uint count = 0) { _quartersController = new QuartersController(MaxQuartersLimit); _state = (count > 0 ? State.NoQuarter : State.SoldOut); _count = count; }