I have custom db class which extends MySQLi class
MySQLi->query() method returns obejct with MySQLi\_Result class, but I want to extend funcionality of this class and somehow make result object to be MyResult class. Something like this:

```
class MyResult extends MySQLi_Result{
  function abc(){
    //...
  }
}

class MyDB extends MySQLi{
  function q($query){
    return /*Here some magic*/ $this->query();
  }
}

$db=new MyDB();
$res=$db->q('SEL...');
$res->abc();

```

How to do this?

EDIT:
Some say that this is duplicate, but problem here is deeper!
I need that $result object would act like Mysqli\_result class obect, so the old code would work.
So I need that, I can call original Mysqli\_result methods like:

```
$res->fetch_assoc();

//but not
$res->result->fetch_assoc();

```