Beispiel #1
0
        static void Main()
        {
            // Create investors
            Investor s = new Investor("Sorros");
            Investor b = new Investor("Berkshire");

            // Create IBM stock and attach investors
            IBM ibm = new IBM("IBM", 120.00);

            ibm.Attach(s);
            ibm.Attach(b);

            // Change price, which notifies investors
            ibm.Price = 120.10;
            ibm.Price = 121.00;
            ibm.Price = 120.50;
            ibm.Price = 120.75;

            // Wait for user
            Console.Read();
        }
Beispiel #2
0
 public void Detach(Investor investor)
 {
     investors.Remove(investor);
 }
Beispiel #3
0
 public void Attach(Investor investor)
 {
     investors.Add(investor);
 }