Exemplo n.º 1
0
        public static CoinSlot Instance()
        {
            if (instance == null)
            {
                lock (syncLock)
                {
                    if (instance == null)
                    {
                        instance = new CoinSlot();
                    }
                }
            }

            return(instance);
        }
Exemplo n.º 2
0
        public static void Run()
        {
            CoinSlot    coinSlot = CoinSlot.Instance();
            List <Coin> coins    = new List <Coin>();

            coinSlot.RefillCoins(coins);

            VendingMachine vendingMachine = VendingMachine.Instance();
            List <Item>    items          = new List <Item>();

            vendingMachine.UpdateInventory(items);

            Display display = new Display();

            coinSlot.Attach(display);
            vendingMachine.Attach(display);

            // Loop to start
        }