I have one PHP class thus:
class DB extends mysqli{
public function __construct(
{
parent::__construct('localhost','user','password','db');
}
}
My problem is that I want to override this class with a new one that performs more privileged database operations with a different db user.
class adminDB extends DB{
public function __construct(
{
??
}
}
}
What should I do here?
You should pass the credentials to the constructor anyway:
Then you don’t need inheritance you can just use:
But if you really want inheritance you could still do this: