Beispiel #1
0
        static void Main(string[] args)
        {
            News   ChinaNews  = new News();
            News   EuropeNews = new News();
            Person person1    = new Person("heqichang");
            Person person2    = new Person("Jim");

            //我自己订阅了中国新闻和欧洲新闻
            person1.Subscribe(ChinaNews);
            person1.Subscribe(EuropeNews);
            //Jim订阅了欧洲新闻
            person2.Subscribe(EuropeNews);

            EuropeNews.AddArticle(new Article()
            {
                Title   = "New title",
                Date    = DateTime.Now.Date,
                Author  = "heqichang",
                Content = "New content"
            });

            Console.ReadKey();
        }