These are my first steps in OOP php.
I have this class in my CMS.
class Pages
{
private static $oInstance = null;
public static function getInstance( ){
if( !isset( self::$oInstance ) ){
self::$oInstance = new Pages( );
}
return self::$oInstance;
} // end function getInstance
/**
* Constructor
* @return void
*/
private function __construct( ){
$this->generateCache( );
} // end function __construct
/**
* Generates cache variables
* @return void
*/
public function generateCache( ){
//some more code
}
};
I want to create my class extending Pages
to make use of its properties and methods:
class New extends Pages{
private static $oInstance = null;
public static function getInstance( ){
if( !isset( self::$oInstance ) ){
self::$oInstance = new Ajax( );
}
return self::$oInstance;
}
public function newmethod(){
//some logic
}
};
However when i attempt to initialize Object, php just generates blank page (even without error).
$object = New::getInstance( );
or
$object = new New();
What am I doing wrong? If I remove constructor from parent and child class at lest page renders.