title: OOP PHP - Newbie exercise on classes
body: <p>Suppose we have two very basic classes: Chapter and Book.</p>
  
  <p>PHP code:</p>
  
  <pre><code>/**
   * Class Chapter
   */
  class Chapter 
  {
      private $title;
  
      public function __construct( $title )
      {
          $this-&gt;title = $title;
      }
  
      public function getTitle() 
      {
          return $this-&gt;title;
      }
  
      public function loadChapterTitle() 
      {
          $title = $this-&gt;getTitle();
          echo $title;
  
          return $title;
      }
  }
  
  /**
   * Class Book
   */
  class Book
  {
      //
  }
  </code></pre>
  
  <p>Usage example:</p>
  
  <pre><code>$myTitleArray = array('first','second','third');
  myBook = new Book($myTitleArray);
  
  $myBook-&gt;loadBookIndex(); // echo: first, second, third
  </code></pre>
  
  <p>In OOP, which is the most elegant way to define the Book class along with its loadBookIndex() method?</p>
  
  <p>EDIT: Just for OO didactic purposes... loadBookIndex() is supposed to use Chapter.</p>