Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Stock ibm = new Stock("IBM", 120);

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

            ibm.Price = 120.10;
            ibm.Price = 121;

            Console.ReadKey();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Stock stock = new Stock("Cheese");

            stock.NoOfItemsInStock = 10; // Register observers.
            Seller seller = new Seller();

            stock.Attach(seller);
            Buyer buyer = new Buyer();

            stock.Attach(buyer);
            stock.NoOfItemsInStock = 4;
            //stock.NoOfItemsInStock = 1;
            Console.ReadKey();
        }