traits学习 越来越多的框架和代码开始使用traits方式去组织一些功能,这是非常高效的代码组织结构. 通过trait来减少不必要的类继承关系,让代码更加复用,形成可以拔插的代码集合. 通过逗号分隔,在 use 声明列出多个 trait,可以都插入到一个类中. 单个的例子: <?php trait Seller { public function sell() { print_r("sell all goods"); } } class MySeller { use Sell…
本文转载至 http://blog.sina.com.cn/s/blog_a843a8850101ds8j.html (一).关于nil http://cocoadevcentral.com/d/learn_objectivec/ Calling Methods on Nil In Objective-C, the nil object is the functional equivalent to the NULLpointer in many other languages. The d…