I have seen some class written as follows: 1- class MyDB extends mysqli { .. ..... public function __construct() { ..... [B]@mysqli_real_connect[/B]( $this->_host, $this->_username, $this->_password, $this->_dbname ); } } Code (markup): If you are using inheritance, why not do so? 2- class MyDB extends mysqli { public function __construct() { [B]parent::[/B]real_connect( $this->_host, $this->_username, $this->_password, $this->_dbname ); } } Code (markup): What is the most elegant way to write? The first or second? Why? Thanks
Not sure if you'd even need parent:: if its an inherited class, since the function is assumed to exist as is. (and only reason to do the first is in case you want to change the way the function works.)