예제 #1
0
class testParent
{
    public function f1()
    {
        echo "poly" . "<br>";
    }
    public function f2()
    {
        echo "niru" . "<br>";
    }
}
class testChild
{
    public function f1($a)
    {
        echo "{$a}" . "<br>";
    }
    function f2($a)
    {
        echo "{$a}" . "<br>";
    }
}
$a = new testChild();
$b = new testParent();
$b->f1();
$b->f2();
$a->f1("Polymorphism");
$a->f2("Inheritence");
?>

예제 #2
0
 public function xyz()
 {
     echo $this->name . '<br>';
     echo 'this is testChild->' . self::abc() . '<br>';
     echo 'this is testchid->' . parent::efg();
 }