示例#1
0
        static void Main(string[] args)
        {
            var coffeeCup = new CoffeeCup();
            var coffeePot = new CoffeePot();
            var workTask  = new WorkTask();

            do
            {
                coffeeCup.Drink();
                workTask.Execute();
                if (coffeeCup.Empty())
                {
                    if (coffeePot.Empty())
                    {
                        coffeePot.Make();
                    }
                    coffeeCup.Refill();
                }
            } while (!workTask.Done());
        }
示例#2
0
 public CoffeeCup(CoffeePot coffeePot)
 {
     this.coffeePot = coffeePot;
 }