您好,欢迎访问一九零五行业门户网

.子内内部调父类属性或方法.解决方法

...子内内部调父类属性或方法...
class a{
     public $m=20;
     function test(){
             echo 1;
     }
}
class b extends a{
...子内内部调父类属性或方法...
}
b继承a,在b类部可以a::test(),parent::test()或者$this->test()这样三种形式调父类的方法,
不知道子类内部调父类属性的方式有几种,难道只有$this->m一种?
分享到: 更多
------解决方案--------------------
调用属性的话:如果是非static类型的,估计只能 $this->test 了。如果是static的可以 parent::test
其它类似信息

推荐信息