I currently have a class called Connect with the following code:
class Connect
{
public $sqlHost='host';
public $sqlUser='user';
public $sqlPass='pass';
public $sqlDB='db';
public $db;
public function __construct() {
$this->db = new mysqli($this->sqlHost, $this->sqlUser, $this->sqlPass, $this>sqlDB);
}
}
?>
I also have a class called TODO and I was wondering, how could I go about calling $db located in the Connect class from the TODO class?
imagine you have have two objects called
now 1 of 3 things can happen, You can pass the $connect object into a method of $todo or if a Connect object is a member of a TODO object, or create a new connect object.
scenario 1:
scenario 2:
scenario 3: