后期静态绑定

Original 2019-07-04 15:53:15 133
abstract:后期静态技术绑定,动态匹配成员的调用者

后期静态技术绑定,动态匹配成员的调用者

品牌:' .self::$product; return '一级分类:' .static::getClass() .'
品牌:' .static::$product; } } class Small extends Big { public static $product = '格力'; public static function getClass() { return __CLASS__; } } echo Big::$product .'
'; echo Big::getClass() .'
'; echo Big::getPro() .'
'; echo Small::$product .'
'; echo Small::getClass() .'
'; echo Small::getPro() .'
';


Correcting teacher:天蓬老师Correction time:2019-07-05 14:40:52
Teacher's summary:其实现在在很多场景下, 类中的需要用到self::的地方, 其实都是可以用static::来替代的, 这样通用性更强一些

Release Notes

Popular Entries