コード例 #1
0
        private static void Main(string[] args)
        {
            var myBook = new Book {Id = 1, Title = "Design Pattern", NumberOfPages = 123};
            var clonedBook = (Book) myBook.Clone();
            Display(myBook);
            Display(clonedBook);

            var myDvd = new DVD {Id = 2, Title = "Design Pattern", Duration = "60:00"};
            var clonedDvd = (DVD) myDvd.Clone();
            Display(myDvd);
            Display(clonedDvd);

            Console.ReadKey();
        }
コード例 #2
0
 private static void Display(DVD dvd)
 {
     Console.WriteLine("\n=======DVD Info=======");
     Console.WriteLine("Id:" + dvd.Id);
     Console.WriteLine("Title:" + dvd.Title);
     Console.WriteLine("Duration: " + dvd.Duration);
     Console.WriteLine("Album:" + dvd.Album);
 }