PHP - 子类使用父类的构造函数

    /*
    * 子类使用父类中的构造方法。
    */

    //父类方法
    class Person {
        //父类中的构造方法
        function __construct(){
            echo '这是父类中的构造方法!';
        }
    }

    //子类方法(继承子父类)
    class MenPerson extends Person {
        //子类重的构造方法
        function __construct(){
            //调用父类中的构造方法
            parent::__construct();
            //调用过之后在继续调用其下的各种实现
            echo '这是子类中的构造方法!';
        }
    }

    //实例化子类对象
    $menp = new MenPerson();