The guys do not know inheritance?
Posted: Thu Aug 27, 2009 3:11 pm
I have seen some class written as follows:
1-
If you are using inheritance, why not do so?
What is the most elegant way to write? The first or second? Why?
Thanks
1-
Code: Select all
class MyDB extends mysqli
{
..
.....
public function __construct()
{
.....
[b]@mysqli_real_connect[/b](
$this->_host,
$this->_username,
$this->_password,
$this->_dbname
);
}
}
Code: Select all
class MyDB extends mysqli
{
public function __construct()
{
[b]parent[/b]::real_connect(
$this->_host,
$this->_username,
$this->_password,
$this->_dbname
);
}
}
Thanks