php调用父类构造方法:首先父类先构造函数,代码为【public function __construct()】;然后使用【parent::__construct()】调用父类构造函数即可。
php调用父类构造方法:
一、使用函数【parent::__construct()】调用父类构造函数
代码如下;
复制";
parent::__construct();//调用父类构造函数}}
$childClass =newChildClass();//对类的实例化?>
二、运行结果
子类的构造函数
父类的构造函数
相关学习推荐:php编程(视频)