示例#1
0
<?php

class MyObject
{
    static function myMethod()
    {
        static::myOtherMethod();
    }
    static function myOtherMethod()
    {
        echo "called from MyObject";
    }
}
class MyOtherObject extends MyObject
{
    static function myOtherMethod()
    {
        echo 'called from MyOtherObject';
    }
}
MyOtherObject::myMethod();
示例#2
0
<?php

class MyObject
{
    function myMethod()
    {
        echo "Standard Functionality\n";
    }
}
class MyOtherObject extends MyObject
{
    function myMethod()
    {
        echo "New Functionality";
        parent::myMethod();
    }
}
$obj = new MyOtherObject();
$obj->myMethod();