-------Now, another question
class DBFactory {
static function create(){
return new MysqlDB();
}
}
class MysqlDB{
function alo(){
echo 'ok';
}
}
$db = DBFactory::create();
$db->alo();
--->Works
class DBFactory {
function create(){
return new MysqlDB();
}
}
class MysqlDB{
function alo(){
echo 'ok';
}
}
$db = new DBFactory;
$db->create();
$db->alo();
--->Not works, can anyone explain?