简体   繁体   中英

php extends a class without rename it

few weeks ago i found on the web a script to use the __constructor and __get for extends the class w/o rename it

that script was able put in the main class all other class wich extends itself so was possible make something like

class mainclass { 
   function __constructor(){  ...something...  }
   function __get(){  ...something else...  }
}
class subclass extends mainclass { 
   function test(){ return "works? how?";  }
}
$class = new mainclass;
$class->test();

that script was very interesting but i've lost it, some one know where find it or how it works?

您的意思是这样吗: 部分课程

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM