im using the following type of class...
class datas{ protected $req ; protected $db ; private function __construct() { $this->db = new Database('localhost', 'user', 'pass', 'db'); $this->db->connect(); } public function prnt() { echo "afafa6e5f1ga56d18a1ge"; } } when i try and access the class like
$y = new datas(); $y->prnt(); Call to protected data::__construct() from invalid context
when i turn it to public, it works. is there any way to make the constructor private and still have the method of call like i have. and i was thinking which one is more secure .
any insight is appreciated guys.