Interface in PHP OOPS

 <?php


//We can not use member variables or data memebers in interface.
//we can not make constructor function in interface.
//we can not use private or protected methods in interface.
interface a
{
    public function abc();
}
interface b
{
    public function xyz();
}
class C implements a, b
{
    public function abc()
    {
        echo "abc function called . <br>";
    }

    public function xyz()
    {
        echo "xyz function called . <br>";
    }
}

$testObject = new C();
$testObject->abc() . "<br>";
$testObject->xyz() . "<br>";

// OUTPUT :
//abc function called .
// xyz function called .
?>

Comments

Popular posts from this blog

Ajax Insert Records in Database Tutorial in PHP

Displaying Database data using Class, Object, Constructor, Destructor in PHP MySql

SubQuery with EXISTS and NOT EXISTS in PHP