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(); }
public void Detach(Investor investor) { investors.Remove(investor); }
public void Attach(Investor investor) { investors.Add(investor); }