示例#1
0
        public static void Main(string[] args)
        {
            CandyShop candyShop = new CandyShop(300);

            candyShop.CreateSweetsCandy(candyShop);
            candyShop.CreateSweetsLollipop(candyShop);
            candyShop.CreateSweetsCandy(candyShop);
            candyShop.CreateSweetsLollipop(candyShop);
            candyShop.PrintInfo();

            candyShop.SellCandy(1);
            candyShop.SellLollipop(2);

            candyShop.PrintInfo();
        }
示例#2
0
 public Candy(CandyShop candyShop)
 {
     candyShop.SugarAmount -= SugarToMake;
     candyShop.Storage[0]++;
 }
示例#3
0
 public void CreateSweetsCandy(CandyShop candyShop)
 {
     Candy candy = new Candy(candyShop);
 }
示例#4
0
 public void CreateSweetsLollipop(CandyShop candyShop)
 {
     Lollipop lollipop = new Lollipop(candyShop);
 }
示例#5
0
 public Lollipop(CandyShop candyShop)
 {
     candyShop.SugarAmount -= SugarToMake;
     candyShop.Storage[1]++;
 }