Beispiel #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");
?>

 function testFunction()
 {
     echo self::$var2 = 3;
     echo parent::$var1 = 5;
 }