Пример #1
0
        static void Main()
        {
            var book  = new Book("Inside Design Patterns", "Smith");
            var video = new Video("Jaws", "Spielberg");

            var borrowableBook = new Borrowable(book);

            borrowableBook.BorrowItem("jane");
            borrowableBook.BorrowItem("mike");
            borrowableBook.Display();

            borrowableBook.ReturnItem("jane");
            borrowableBook.Display();


            var borrowableVideo = new Borrowable(video);

            borrowableVideo.BorrowItem("steve");
            borrowableVideo.BorrowItem("lisa");
            borrowableVideo.Display();

            // Alternative method for decorators
            var aDifferentBorrowableBook = book.WithBorrowable();

            aDifferentBorrowableBook.BorrowItem("steve");

            Console.ReadLine();
        }
Пример #2
0
        static void Main()
        {
            var book = new Book("Inside Design Patterns", "Smith");
            var video = new Video("Jaws", "Benchley");

            var borrowableBook = new Borrowable(book);
            borrowableBook.BorrowItem("jane");
            borrowableBook.BorrowItem("mike");
            borrowableBook.Display();

            var borrowableVideo = new Borrowable(video);
            borrowableVideo.BorrowItem("steve");
            borrowableVideo.BorrowItem("lisa");
            borrowableVideo.Display();

            Console.ReadLine();
        }
Пример #3
0
        static void Main()
        {
            var book  = new Book("Inside Design Patterns", "Smith");
            var video = new Video("Jaws", "Benchley");

            var borrowableBook = new Borrowable(book);

            borrowableBook.BorrowItem("jane");
            borrowableBook.BorrowItem("mike");
            borrowableBook.Display();

            var borrowableVideo = new Borrowable(video);

            borrowableVideo.BorrowItem("steve");
            borrowableVideo.BorrowItem("lisa");
            borrowableVideo.Display();

            Console.ReadLine();
        }