PHP 忒聊
綴豖
梒 14. 濬迵勤砓
ヶ輛
parent
絞斕楷珋赻撩淏婓迡珨虳溼恀價濬腔曹講睿滲杅腔測鎢奀ㄛ涴喃煦佽隴賸 斕腔巖汜濬準都腔儕褶﹜蚳珛﹝
Instead of using the literal name of the base class in your code, you should be using the special name parent, which refers to the name of your base class as given in the extends declaration of your class. By doing this, you avoid using the name of your base class in more than one place. Should your inheritance tree change during implementation, the change is easily made by simply changing the extends declaration of your class. 斕茼蜆婓測鎢笢妏蚚蚳蚚靡備 parent 杸測價濬腔靡備ㄛ 懂溼恀
class A {function example() {echo "I am A::example() and provide basic functionality. br \n";}} class B extends A {function example() {echo "I am B::example() and provide additional functionality. br \n"; parent::example();}} $b = new B; // This will call B::example(), which will in turn call A::example(). $b- example();
綴豖
れ萸
ヶ輛
::
奻珨撰
唗蹈趙勤砓ㄜ頗趕笢腔勤砓