/// <summary> /// Entry point into console application. /// </summary> static void Main() { // Configure Observer pattern Celebrity s = new Celebrity(); s.Name = "Michael Jackson"; s.Follow(new Follower(s, "Carl")); s.Follow(new Follower(s, "Emily")); // Change subject and notify observers s.Tweet = "hey guys I am going to disney world"; s.Notify(); Console.WriteLine(""); s.Tweet = "I just got off Space Mountain, it was wicked"; s.Notify(); // Wait for user Console.ReadKey(); }
// Constructor public Follower( Celebrity subject, string name) { this._subject = subject; this._name = name; }