예제 #1
0
?>
--FILE--
<?php 
class Bar
{
    public function pub()
    {
        $this->priv();
    }
    private function priv()
    {
        echo "Bar::priv()\n";
    }
}
class Foo extends Bar
{
    public function priv()
    {
        echo "Foo::priv()\n";
    }
}
$obj = new Foo();
$obj->pub();
$obj->priv();
echo "Done\n";
?>
--EXPECTF--
Bar::priv()
Foo::priv()
Done
예제 #2
0
<?php

class Bar
{
    public static function pub()
    {
        Bar::priv();
    }
    private static function priv()
    {
        echo "Bar::priv()\n";
    }
}
class Foo extends Bar
{
    public static function priv()
    {
        echo "Foo::priv()\n";
    }
}
Foo::pub();
Foo::priv();
echo "Done\n";