title: PHP and Classes: access to parent's public property within the parent class
body: <p>here is what my code looks like</p>
  
  <p>i have two forms:</p>
  
  <pre><code>class Form_1 extends Form_Abstract {
  
      public $iId = 1;
  
  }
  class Form_2 extends Form_1 {
  
      public $iId = 2;
  
  }
  </code></pre>
  
  <p>i expect the code behave like this:</p>
  
  <pre><code>$oForm = new Form_2;
  echo $oForm-&gt;getId(); // it returns '2'
  echo $oForm-&gt;getParentId(); // i expect it returns '1'
  </code></pre>
  
  <p>here is my Form_Abstract class:</p>
  
  <pre><code>class Form_Abstract {
  
      public $iId = 0;
  
      public function getId() {
          return $this-&gt;iId;
      }
  
  /**
  this method will be called from a child instance
  */
      public function getParentId() {
          return parent::$iId;
      }
  }
  </code></pre>
  
  <p>but it throws a Fatal Error:</p>
  
  <pre><code>Fatal error: Cannot access parent:: when current class scope has no parent
  </code></pre>
  
  <p>please help me with the method <code>getParentId()</code></p>
  
  <p><strong>PS:</strong> i know the reason of what happens, i am seeking for the solution.</p>