Esempio n. 1
0
        static void Main()
        {
            IBM ibm = new IBM("IBM", 120.00);

            ibm.Attach(new Investor("Sorros"));
            ibm.Attach(new Investor("Berkshire"));

            ibm.Price = 120.10;
            ibm.Price = 121.00;
            ibm.Price = 120.50;
            ibm.Price = 120.75;
            ibm.Price = 120.75;

            Console.ReadKey();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            //Create IBM stock and attach investors
            IBM ibm      = new IBM("IBM", 120.00);
            var investor = new Investor("George Sorros");

            ibm.Subscribe(investor);
            ibm.Subscribe(new Investor("Bill Gates"));
            ibm.Subscribe(new Investor("Bruce Willis"));

            //Fluctuating prices will notify investors
            ibm.Price = 120.10;
            ibm.Price = 121.00;
            ibm.Price = 120.50;
            ibm.Price = 120.75;

            //Unsubscribe George
            ibm.Unsubscribe(investor);

            ibm.Price = 119.30;
            ibm.Price = 118.00;

            Console.ReadKey();
        }