static public void Main() { ConcreteSubject subject = new ConcreteSubject("A"); subject.Attach(new ConcreteObserverX("A")); subject.Attach(new ConcreteObserverY("A")); subject.Attach(new ConcreteObserverZ("A")); //改变状态 subject.ChangeData("B"); }