void Print(Newspapper news) { Console.WriteLine("{0} 读报了!", this.Name); Console.WriteLine("今日报纸头条:{0} !", news.Title); Console.WriteLine("日期:{0} ", news.Date.ToString("yyyy-MM-dd")); Console.WriteLine("内容:{0} ", news.Content); }
public void Begin() { ISubject newspapper = new Newspapper(); IObserver observer = new Person(); newspapper.RegisterObserver(observer); newspapper.NotifyObserver(null); }