title: PHP Inherited parent method can't access child's private property
body: <p><em>First of all: A <a href="https://stackoverflow.com/questions/3484165/php-accessing-a-childs-private-properties-in-parent">quite similar problem</a> has been posted and somehow solved already, but is still not answering my specific problem. More about this later.</em></p>
  
  <p><strong>In words:</strong> I have a base class which provides some methods to all childs, but doesn't contain any property. My child is inheriting these methods, which should be used to access the child's properties.
  If the child's property is <code>protected</code> or <code>public</code>, all works fine, but if the child's property is <code>private</code>, it fails without error (just nothing happens).</p>
  
  <p><strong>In code:</strong></p>
  
  <pre><code>class MyBaseClass {
      public function __set($name, $value) {
          if(!property_exists($this, $name))
              throw new Exception("Property '$name' does not exist!");
          $this-&gt;$name = $value;
      }
  }
  
  class ChildClass extends MyBaseClass {
      public $publicProperty;
      protected $protectedProperty;
      private $privateProperty;
  }
  
  $myChild = new ChildClass();
  $myChild-&gt;publicProperty = 'hello world';    //works of course!
  $myChild-&gt;protectedProperty = 'hello world'; //works as expected
  $myChild-&gt;privateProperty = 'hello world';   //doesn't work?
  </code></pre>
  
  <p>The above mentioned similar problem got the solution to use the magic <code>__set()</code> method to access the private properties, but this I am already doing. If I implement <code>__set()</code> within the child, it works of course, but the idea is, that the child inherits the <code>__set()</code> from it's parent, but obviously it can't access the child's private method.</p>
  
  <p>Is that on purpose? Am I doinf something wrong? or is my approach just crap by design?</p>
  
  <p><strong>Background:</strong>
  My original idea was: The whole dynamic thing about <code>__set()</code> is something I don't like. Usually a private property should <em>never</em> be accessible from outside, so I implemented throwing __set- and __get-methods in my ultimate base class (from which all classes inherit).</p>
  
  <p>Now I want to dynamicially spawn an instance from an XML file and therefore need access to properties. I made the rule, that any XML-instantiatable class needs to implement the magic <code>__set()</code> method and so can be created dynamicially. Instead of implementing it in every Class that might be spawned some day, I decided to make them inherit from a class called like <code>class Spawnable { }</code> which provides the needed __set-method.</p>