Exemple #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            ChocolateBoiler chocolateBoiler = ChocolateBoiler.GetChocolateBoiler();

            chocolateBoiler.Fill();
            chocolateBoiler.Drain();
        }
Exemple #2
0
 public static ChocolateBoiler getInstance()
 {
     if (uniqueBoiler == null)
     {
         uniqueBoiler = new ChocolateBoiler();
     }
     return(uniqueBoiler);
 }
Exemple #3
0
        public static ChocolateBoiler GetChocolateBoiler()
        {
            lock (padlock)
            {
                if (_chocolateBoiler == null)
                {
                    _chocolateBoiler = new ChocolateBoiler();
                }

                return(_chocolateBoiler);
            }
        }
        static void Main(string[] args)
        {
            ChocolateBoiler cb1 = ChocolateBoiler.Instance;

            cb1.Fill();
            cb1.Boil();
            ChocolateBoiler cb2 = ChocolateBoiler.Instance;

            cb2.Drain();

            Console.ReadKey();
        }
Exemple #5
0
        private static void PrintDarkChocolateDetails()
        {
            ChocolateBoiler fromDarkChoco = new ChocolateBoiler();

            fromDarkChoco.PrintDetails("I'm dark chocolate!");

            Thread.Sleep(5000);
            fromDarkChoco.Fill();

            Thread.Sleep(5000);
            fromDarkChoco.Boil();

            Thread.Sleep(5000);
            fromDarkChoco.Drain();
        }
Exemple #6
0
        private static void PrintWhiteChocolateDetails()
        {
            ChocolateBoiler fromWhiteChoco = new ChocolateBoiler();

            fromWhiteChoco.PrintDetails("I'm white chocolate!");


            Thread.Sleep(2000);
            fromWhiteChoco.Fill();

            Thread.Sleep(2000);
            fromWhiteChoco.Boil();

            Thread.Sleep(2000);
            fromWhiteChoco.Drain();
        }