title: accessing class variables from extended class with getter and setters
body: <p>Im trying to access a variable from one class through another class from a php script:</p>
  
  <p>My first class is: </p>
  
  <p>class data{</p>
  
  <pre><code>  private $length;
    private $height;      
  
     public function setLength($length){
      $this-&gt;length = $length;
     }
  
     public function getLength(){
      return $this-&gt;length;
     }
  
    public function setHeight($height){
      $this-&gt;height = $height;
     }
  
     public function getHeight(){
      return $this-&gt;height;
     }
  
  }
  </code></pre>
  
  <p>I have another class:</p>
  
  <pre><code>class proccess extends data{
  
     public function getOrientation(){
        if($this-&gt;getLength() &gt; $this-&gt;getHeight()) {
         $orientation = 'landscape';
        } else {
        $orientation = 'portrait';
     }
  
     }
  </code></pre>
  
  <p>}</p>
  
  <p>When trying to access $this->getLenght() or $this-getHeight() from class process the values are empty; I am setting the values through my php script as so:</p>
  
  <pre><code>&lt;?php
  
  
    require_once('functions/data.php');
    require_once('functions/process.php');
  
    $data=new data();
    $process = new process();
  
    $data-&gt;setLength(25);
    $data-&gt;setHeight(30);
    $orientation = $process-&gt;getOrientation();
  </code></pre>
  
  <p>Any ideas on why the function getOrientation is not able to get the value of width and length and how i can fix this?</p>