Beispiel #1
0
        static void Main()
        {
            Console.WriteLine("Example for \"Author\" class:");
            DateTime date1   = new DateTime(1828, 9, 9);
            Author   author1 = new Author("Lev", "Tolstoy", date1);

            Console.WriteLine(author1);
            Author author2 = author1.Clone() as Author;

            author2.Name     = "King";
            author2.Surname  = "Stephen";
            author2.Birthday = new DateTime(1947, 9, 21);
            Console.WriteLine(author2);
            Console.WriteLine("Are the authors equal: {0}", author1 == author2);
            Console.WriteLine("Example of partial print: {0}", author2.PartPrint());

            Console.WriteLine("Example for \"Article\" class:");
            Article article1 = new Article(author1, "Anna Karenina", 864, 81);
            Article article2 = article1.Clone() as Article;

            article2.Pages = 1270;
            article2.Cost  = 150;
            article2.Title = "War and Peace";
            Console.WriteLine("Example of ToString method of Article:\n{0}", article2);
            Console.WriteLine("\nExample of result of comparison operator < : {0}", article1 < article2);
            Console.WriteLine("Example of partial print: {0}", article2.PartPrint());
            Console.WriteLine("Example for \"Magazine\" class");
            Article[] articles  = { article1, article2 };
            Magazine  magazine1 = new Magazine(Periodicity.Monthly, author1, "Literature", 100, articles);
            Magazine  magazine2 = magazine1.Clone() as Magazine;
            Magazine  magazine3 = new Magazine();

            magazine3.Period        = Periodicity.Quarterly;
            magazine3.Size          = 10;
            magazine3.MagazineTitle = "Literature";
            magazine3.AddArticle(article2.Clone() as Article);
            Console.WriteLine(magazine3.PartPrint());
        }
Beispiel #2
0
 public Magazine(Magazine magazine) : this(magazine.Period, magazine.THisAuthor, magazine.MagazineTitle, magazine.Size, magazine.ArticlesInfo)
 {
 }