title: PHP Inheritance: Child has same class name as parent
body: <p>I am interested if its possible with any trickery, and or cool PHP features to have a child class inherit from a parent and have the same name as a parent.  This should be able to be repeated as many times as desired.</p>
  
  <p>This can be done in a number of ways I figure, but I am interested to see what the community turns up.</p>
  
  <p>I am interested to also hear if people think this is useful or if standard inheritance is just as acceptable.  </p>
  
  <p>Really the power that I see in it, (assuming the base object is built correctly). is amazingly long term extend ability and maintainability, while being super pro and also not making your average bear confused to all living heck.</p>
  
  <p>Lets pretend we have some active record base types.</p>
  
  <p>Class Active Record => Contacts</p>
  
  <p>I want to Override Contacts with MyContacts but would rather see everywhere in the system currently using Contacts to not have to be changed in anyway whatsoever... and Instead be branded as Contacts.</p>
  
  <p>Active Record -> Contacts -> MyContacts (Contact).</p>
  
  <p>Theoretically as above stated it should be possible to do.</p>
  
  <p>Active Record -> Contacts -> MyContacts (Contact ) -> YourContacts (Contact).</p>
  
  <p>Anywhere Contacts is referenced should still not give any Undefined class, or not give the child's most functionality whenever present.</p>
  
  <p>How could this be achieved without doing something like...</p>
  
  <pre><code>$class_name = ClassFactory::instance("Contact");
  $class = new $class_name($args);
  </code></pre>
  
  <p>What we are looking for:
      $class = new Contacts();</p>
  
  <pre><code>Where $class could be the newest version of Contacts
  
  
  Active Record =&gt; Contacts
  Active Record =&gt; Contacts -&gt; MyContacts (Contact)
  Active Record =&gt; Contacts -&gt; MyContacts (Contact) -&gt; YourContacts (Contact).
  </code></pre>
  
  <p>In the case of</p>
  
  <pre><code>$class-&gt;undefinedFun();
  </code></pre>
  
  <p>Accepted that -> Absolute base class, or __call function of any of the teirs of the class would define if it is an error or not.  </p>