phpmultiple-inheritancemagic-function

Magic functions and inheritance


I would like to know if it's possible to create a magic object that extends another magic object, (with PHP).


Solution

  • I'm not totally sure what you're asking... are you wanting to explicitly invoke the magic methods of the parent class? If so, you can use the class' parent reference:

    class Object extends dbObj{
        // ...
        // this is what i'm assuming you're looking for:
        public function __call($method, $variables){
            return parent::__call($method, $variables);
        }
    }