title: Why doesn't this work? OOP novice
body: <p>I am new to OOP, so please do not be harsh.</p>
  
  <p>My task is that this:</p>
  
  <pre><code> $color = new Color(127,0,0);
   $rect = new Rectangle($color, 100, 50);
   $rect-&gt;render();
  </code></pre>
  
  <p>Should bring to the page the following code:</p>
  
  <pre><code> "div style="background-color:RGB(127,0,0);width:100px;height:50px"&gt;&lt;/div&gt;"
  </code></pre>
  
  <p>Below is my OOP code. The goal was to use an abstract class <code>Component</code> and with an abstract method <code>render()</code>. I am trying to figure out why code doesn't work:</p>
  
  <pre><code> class Color {
      protected $red;
      protected $green;
      protected $blue;
      public function __construct($red, $green, $blue) {
      $this-&gt;red = $red;
      $this-&gt;green = $green;
      $this-&gt;blue = $blue;
      }
   }
    abstract class Component {
  
      protected $color;
      protected $width;
      protected $height;
  
      public function __construct($color) {
  
      $this-&gt;color = new Color();
  
      }
  
      abstract function render();
  
    }
    class Rectangle extends Component {
      public function __construct($color, $width, $height){
      parent::__construct();
      $this-&gt;color = $color;
      $this-&gt;width = $width;
      $this-&gt;height = $height;
      }
      public function render() {
      echo "&lt;div style='background-color:RGB(" . $this-&gt;color . ");width:" . $this-&gt;width .     "px;height:" . $this-&gt;height . "px'&gt;&lt;/div&gt;";
      }
     }
    $color = new Color(127,0,0);
    $rect = new Rectangle($color, 100, 50);
    echo $rect-&gt;render();
  </code></pre>