예제 #1
0
파일: 2-8.php 프로젝트: quekaihua/StudyTest
<?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
파일: 2-4.php 프로젝트: quekaihua/StudyTest
<?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();