public GumBallMachine() { NoQuarterStateObj = new NoQuarterState(this); HasQuarterStateObj = new HasQuarterState(this); SoldStateObj = new SoldState(this); SoldOutStateObj = new SoldOutState(this); state = SoldOutStateObj; }
public void Refill(int n) { GumBallsCount = n; state = NoQuarterStateObj; }
public void SetState(IGumBallMachineState newState) => state = newState;