关于后期静态绑定
看了php手册中关于后期静态绑定,还是不太明白,原文地址http://cn2.php.net/manual/zh/language.oop5.late-static-bindings.php
其中第四个例子
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> <?php class A { public static function foo() { static::who(); } public static function who() { echo __CLASS__."\n"; } } class B extends A { public static function test() { A::foo(); parent::foo(); self::foo(); } public static function who() { echo __CLASS__."\n"; } } class C extends B { public static function who() { echo __CLASS__."\n"; } } C::test(); ?>
self::foo(); // 这个self实际上是C类。明白吗? C::test() C继承了B的test()方法 <div class="clear"> </div>