PHP program to demonstrate the inheritance of interfaces

bookmark

<?php
//PHP program to demonstrate the inheritance of interfaces.
interface Inf1
{
    public function Fun1();
}
interface Inf2 extends Inf1
{
    public function Fun2();
}

class Sample implements Inf2
{
    function Fun1()
    {
        printf("Fun1() called<br>");
    }

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

$obj = new Sample();

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

?>


Output
Fun1() called
Fun2() called