Interface is a class or we can say base class which is implement in a child calss. We defined interface by using keyword interface. all method or function of a interface should be public according the nature of interface.Function in interface does not have any functionality these are overwride in child class and these are necessary to use child class
interface setTemplate { public function setVar($var); public function getVar($var); } class template implements setTemplate{ fuction setVar($var){ function body....... } fuction getVar($var){ function body....... } }
if we does not use all function of a interface then it will give erorr
class template implements setTemplate{ fuction setVar($var){ function body....... } }
the above code will return error
like abstract class we can create object of a interface we only implement it in a child class