Post-binding/Delayed binding of the parent class and subclass in PHP & lt ;? Php & nbsp;/***** & nbsp; & nbsp; public welfare PHP Lecture Hall & nbsp; altar: & nbsp; http://www.zixue.it & nbsp; Micro & nbsp; blog: PHP in the parent class and subclass of the late binding/delay binding
-
- /****
- Yan 18 public welfare PHP Lecture Hall
-
- Discussion: http://www.zixue.it
- Micro Bo: http://weibo.com/Yshiba
- YY Channel: 88354001
- ****/
- /***
- === Note ====
- Post-binding/Delayed binding
- ***/
- Class Human {
- Public static function whoami (){
- Echo 'whoami from parent class is being executed ';
- }
- Public static function say (){
- Self: whoami (); // There is no say method in the subclass. the parent class is found here.
- // Here self refers to the parent class
- }
- Public static function say2 (){
- Static: whoami (); // The sub-class does not have the say2 method. find the parent class here.
- // But the parent class uses static: whoami,
- // Call your own whoami method.
- }
- }
- Class Stu extends Human {
- /*
- Public static function whoami (){
- Echo 'from subclass whoami is being executed ';
- }
- */
- }
- Stu: say ();
- Stu: say2 ();