public void BuyItems(Sale sale)
        {
            // Check that no payments have been made
            if (sale.AmountDue == sale.SaleTotal)
            {
                // Call the ReallyBuyItems method
                sale.ReallyBuyItems();

                // Switch to Shopping state since they are still buying items
                sale.SaleState = new ShoppingSaleState();
            }
            // Do nothing because payment is process
        }
コード例 #2
0
 public void BuyItems(Sale sale)
 {
     sale.ReallyBuyItems();
 }