What is difference between Abstract class and Interfaces in php?
Abstract class | Interfaces |
Abstract classes can have abstract methods and non abstract methods. | Interfaces can have only abstract methods. |
We can create the variables in Abstract classes. | Interfaces do not contain variables. |
We can use access specifier like public or protected in Abstract classes. | We can use only public access specifier in Interfaces |
Multiple inheritance is not possible in Abstract classes. | Multiple inheritance is possible by using interfaces . |
We can access the abstract class properties from derived class by using 'extends' keyword | We can access interface from derived class by using 'implement' keyword. |
Abstract classes can contain constructor. | Interface doesn't contain constructor. |
Only complete member of Abstract classes can be static. | Member of Interface can not be static. |
Comments