Best Example of Inheritance

<?php
class DB_Connection{
private $host = 'localhost';
private $user = 'root';
private $pass = '';
private $db_name = 'test';

protected $db_connect;

public function __construct(){
$this->db_connect = mysqli_connect($this->host,$this->user,$this->pass,$this->db_name);
if(!$this->db_connect){
die('Connection Problem : '.mysqli_error($this->db_connect));
}
}
}


class Student extends DB_Connection{

public function __construct(){
parent::__construct();
}
}




?>

Comments

Popular posts from this blog

WP register_post_type() with custom CMB2 meta box

Git post receive setup at server for git push to the production from local machine