In "Best Practices for Android and PHP development", we can see that "PHP interface is very expensive. Please use abstract classes instead of interfaces as much as possible". This is a bit dizzy and requires specific analysis. In "Best Practices for Android and PHP development", we can see that "PHP interfaces are expensive. Please use abstract classes instead of interfaces as much as possible". This is a bit dizzy for specific analysis.
Reply content:
In "Best Practices for Android and PHP development", we can see that "PHP interfaces are expensive. Please use abstract classes instead of interfaces as much as possible". This is a bit dizzy for specific analysis.
The performance is high and low. I cannot analyze it here. I don't think it is necessary to analyze it.
Abstract classes have different purposes than interface classes. They are used differently.
An interface class defines some interface standards and is not implemented. The class that implements the interface class must express that I have methods defined in the interface class, but the specific implementation methods vary.
Abstract class, which can implement specific methods and inherit the class of the abstract class, I use the abstract class method, including the specific implementation (the subclass can also override the method to overwrite the parent class)
Note: What I'm talking about isImplementation Interface Class
,Inherit abstract classes
In PHP, onlyExtends
A parent class (including abstract classes), but canImplements
Multiple interface classes, which are differentiated in usage.
I have never read the book you mentioned. I think it is necessary to have your own distinction and use it properly.
There is a small difference in real-time performance, but it is acceptable to sacrifice a little performance for the maintainability of the program.
$ ClassName = "xxx"; $ instance = new $ className;
Is this an interface or an abstract class?