如何向子方法添加更多功能?

How do I add more functionality to child method?

parent_says() 方法说明了一些问题,现在我想向 parent_says() 方法添加更多功能,但从子 class 内部添加。我该怎么做?

    class Parent_class{
    function parent_says(){
        echo "HI. I'm parent!";
    }
}

class Child_class extends Parent_class{
    function parent_says(){
        //I want it to also says "HI. I'm parent!", that's inside parent method.
        echo "I say hello!";
    }
}

$Child_class = new Child_class;
$Child_class->parent_says();

使用parent::先调用父class'方法。例如

class Child_class extends Parent_class{
    function parent_says(){
        parent::parent_says();
        echo "I say hello!";
    }
}

有关详细信息,请参阅 here