Objective-c 知识总结 -- 复合
2016-05-08 本文已影响31人
半纸渊
?复合 ?
Including pointers to objects as instance variables;(包含了一个对象实例变量的指针)

?构建一个类选择使用 继承 还是 复合?
Inheritance sets up an “is a” relationship. --> 什么就是(源自于)什么
Composition, on the other hand, sets up a “has a” relationship. --> 什么拥有(包含了)什么
简而言之,复合 就是一个类中拥有另一个类的实例;