I have a single class that calls aload of other classes;
require_once('class.database.php');
require_once('class.users.php');
Class Bootstrap {
public $db;
public $users;
public function __construct() { $this->db = new Database(); $this->users = new Users(); }
}
$est = new Bootstrap();
And that class works fine, but lets say in my Database class I have;
class Database {
public function __construct() { }
public function foo() {
echo 'hi';
}
}
And then from the users class, I'd like to reference the function, but I wanna keep the code clean and therefore want to steer away from statics.
I've tried referencing it such as:
* $est->db->foo();
* $db->foo();
But none of them work, could somebody please show me the correct way to call it. Thanks!