Following are some main difference between abstract classes and interface in php
- In abstract classes this is not necessary that every method should be abstract. But in interface every method is abstract.
- Multiple and multilevel both type of inheritance is possible in interface. But single and multilevel inheritance is possible in abstract classes.
- Method of php interface must be public only. Method in abstract class in php could be public or protected both.
- In abstract class you can define as well as declare methods. But in interface you can only defined your methods.
No comments:
Post a Comment