Beispiel #1
0
        public static ChocolateBoiler getInstance()
        {
            return(_chocolateBoiler);

            if (_chocolateBoiler == null)
            {
                Console.WriteLine("Creating an instance!!!!!!!!!!!!!!");
                _chocolateBoiler = new ChocolateBoiler();
            }
            return(_chocolateBoiler);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            var boilerDarkChocolate            = ChocolateBoiler.getInstance();
            var boilerWhiteChocolate           = ChocolateBoiler.getInstance();
            var boilerChocolateWithOrange      = ChocolateBoiler.getInstance();
            var boilerWhiteChocolateWithFruits = ChocolateBoiler.getInstance();
            var boilerDarkChocolateWithMint    = ChocolateBoiler.getInstance();


            Console.WriteLine("Dark Chocolate is Empty: " + boilerDarkChocolate.isEmpty());
            Console.WriteLine("Dark White is Empty: " + boilerDarkChocolate.isEmpty());

            Console.WriteLine("Filling the Dark Chocolate Boiler");
            boilerDarkChocolate.Fill();
            Console.WriteLine("Dark Chocolate is Empty: " + boilerDarkChocolate.isEmpty());
            Console.WriteLine("Dark White is Empty: " + boilerDarkChocolate.isEmpty());

            Console.WriteLine("Emptying the White Chocolate Boiler");
            boilerWhiteChocolate.Drained();
            Console.WriteLine("Dark Chocolate is Empty: " + boilerDarkChocolate.isEmpty());
            Console.WriteLine("Dark White is Empty: " + boilerDarkChocolate.isEmpty());
        }