Advertisement
rogal1981

Untitled

Dec 18th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.57 KB | None | 0 0
  1. <?php
  2.  
  3. class SimpleBook {
  4.     private $author;
  5.     private $title;
  6.     function __construct($author_in, $title_in) {
  7.         $this->author = $author_in;
  8.         $this->title  = $title_in;
  9.     }
  10.     function getAuthor() {
  11.         return $this->author;
  12.     }
  13.     function getTitle() {
  14.         return $this->title;
  15.     }
  16. }
  17.  
  18. class BookAdapter {
  19.     private $book;
  20.     function __construct(SimpleBook $book_in) {
  21.         $this->book = $book_in;
  22.     }
  23.     function getAuthorAndTitle() {
  24.         return $this->book->getTitle().' by '.$this->book->getAuthor();
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement