Code: Select all
function __construct()
{
include('../../classes/Obj.class.php');
$Obj = new Obj;
$Obj->connect();
}
function getSomething()
{
//use $Obj here
}
Moderator: General Moderators
Code: Select all
function __construct()
{
include('../../classes/Obj.class.php');
$Obj = new Obj;
$Obj->connect();
}
function getSomething()
{
//use $Obj here
}
Code: Select all
include('../../classes/Obj.class.php');
class A {
protected $obj = null;
public function __construct()
{
$this->obj = new Obj;
$this->obj->connect();
}
public function getSomething()
{
//use $this->obj here
}
}