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
Post a Comment