Code highlighting produced by Actipro Codehighlighter (freeware) http://www.codehighlighter.com/--> 1 <?phpclassParentbase {Static $property= ' Parent Value '; Public Static functionrender () {returnSelf::$property; }}classDescendantextendsParentbase {Static $property= ' descendant Value ';}EchoDescendant::render (); Parent Value
In this example, the render () method uses the Self keyword, which refers to the Parentbase class instead of the descendant class. The final value of the $property cannot be accessed in the Parentbase::render () method. To solve this problem, you need to override the render () method in the subclass.
By introducing the lazy static binding feature, you can use the static scope keyword to access the properties of a class or the final value of a method.
Code highlighting produced by Actipro Codehighlighter (freeware) http://www.codehighlighter.com/--> 1 <?phpclassParentbase {Static $property= ' Parent Value '; Public Static functionrender () {return Static::$property; }}classDescendantextendsParentbase {Static $property= ' descendant Value ';}EchoDescendant::render ();D escendant Value
Use of "lazy static bindings"