PHP program to demonstrate the inheritance of abstract classes

bookmark

<?php
//PHP program to demonstrate the inheritance 
//of abstract classes.
abstract class Abs1
{
    public abstract function Fun1();
}
abstract class Abs2 extends Abs1
{
    public abstract function Fun2();
}

class Sample extends Abs2
{
    function Fun1()
    {
        printf("Fun1() called<br>");
    }

    function Fun2()
    {
        printf("Fun2() called<br>");
    }
}

$obj = new Sample();

$obj->Fun1();
$obj->Fun2();

?>

 

Output
Fun1() called
Fun2() called