class People(){ public function father(){} } class Man extends People{ public function father(){//重写父类方法 parent::father();//访问父类方法 } }
Man类就可以使用People定义的方法
重写直接重新定义名字一样的就行了。要访问父类的方法可以通过parent::方法()访问。