Difference between Class Abstraction and Object Interfaces in PHP?
- by Mark Tomlin
What is the difference between a Class Abstraction and an Object Interfaces in PHP? I ask because, I don't really see the point to both of them, they both do the same thing! So, what are the advantages of disadvantages using both against one or the other?
Class Abstraction:
abstract class aClass
{
// Force extending class to define these methods
abstract public function setVariable($name, $var);
abstract public function getHtml($template);
}
Object Interface:
interface iClass
{
// Force impementing class to define these methods
public function setVariable($name, $var);
public function getHtml($template);
}