关于类继承函数重载的问题?大神进
- PHP code
class a{function a(){...}function select(){...}}class b extends a{function b(){...}function select(){//这里能调用a类的select函数,但是我的感觉好像写法不规范,老感觉会死循环..$this->select();//是不是有别的写法//这写法 $a = new a(); $a->select();是不是比较耗内存,重新定义了一个对象)}}[解决办法]
只能这样写
parent::select();
$this->select();
这样写就是递归了
除非你确有需要,不然就锁死了
[解决办法]
$this代表的本身,如果想调用你类的话,就用parent::,你这样写是重写了自己.