Cocoa设计之TwoStage Creation

Cocoa设计之TwoStage Creation

  TwoStage Creation有三个好处:

  1、Enable the use of initializers regardless of the way memory is allocated 

  2、Avoid the need to implement too many initializers when subclassing

  3、Simplify the creation and use of temporary instances 

  

  个人认为最主要的还是通过拆分分配与初始化,避免了初始化方法的几何增长爆炸。参考《Cocoa设计模式》。

原文地址:https://www.cnblogs.com/tekkaman/p/2891978.html