Difference between Class Abstraction and Object Interfaces in PHP?

Posted by Mark Tomlin on Stack Overflow See other posts from Stack Overflow or by Mark Tomlin
Published on 2010-06-10T22:09:26Z Indexed on 2010/06/10 22:12 UTC
Read the original article Hit count: 180

Filed under:
|
|

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);
}

© Stack Overflow or respective owner

Related posts about php5

Related posts about interface