Inheritance class of another type
<p>For my project I've wrote a basic controller class:</p>

<pre><code>&lt;?php
   abstract class Controller
   {
      static $__instance = null;

      protected function __construct()
      {
      }

      final private function __clone()
      {
      }

      public static function getInstance()
      {
         $class = get_called_class();

         return self::$__instance ? self::$__instance : (self::$__instance = new $class());
      }
   }
?&gt;
</code></pre>

<p>Now every controller does inheritance from this controller.</p>

<p>Like this:</p>

<pre><code>&lt;?php

   include_once 'model/page.php';
   include_once 'view/page.php';

   class PageController extends Controller
   {
      private $m_model = null;

      private $m_view = null;

      private $m_id;

      protected function __construct()
      {
         parent::__construct();

         $this-&gt;m_id = uniqid();

         $this-&gt;m_model = new PageModel();
         $this-&gt;m_view = new PageView();
      }

      public function preparePage()
      {
         echo 'Hello';
      }
   }
?&gt;
</code></pre>

<p>And in my index.php I got this:
    $user = UserController::getInstance();
    $page = PageController::getInstance();
    var_dump($page);</p>

<p>The problem is that the <code>var_dump($page)</code> shows that the variable $page is type of UserController, but why? It should be of the type PageController. Any ideas?</p>
