1: Success {code...} 2: Failure {code...} I want to know how to understand static correctly and how to use static appropriately? 1: Successful
2: Failed
I want to know how to understand static correctly and how to use static appropriately?
Reply content:
1: Successful
2: Failed
I want to know how to understand static correctly and how to use static appropriately?
After PHP 5.3Delayed binding. Http://www.php-internals.com/book? P = chapt05/05-05-class-magic-methods-latebinding
In earlier versions, if you run the following code:
$ Foo gets a Domain object instead of a Document Object. This is because a problem exists in the previous PHP version, that is, the parent class cannot obtain the subclass State, resulting in inheritance.selfThis value points to the parent class rather than the Child class. To implement normal functions, you must rewrite the method in the subclass.
Later, in PHP 5.3staticTo achieve delayed binding, you only need to usestaticTo replaceselfKeyword.
It is easy to understand that self is the parent class of the current class or the current class. In this example, it is definitely wrong to instantiate an abstract class. The official explanation of static is the meaning of static late binding, and the popular point is a sub-class. In this case, the landlord's example will surely be accessible.