在C++中,类与类之间的关系大概有四种,分别为继承,关联,聚合,和组合.其中继承我们大家应该都比较熟悉,因为是C++的三大特性继承Inheritance,封装Encapsulation,和多态Polymorphism之一. 继承Inheritance:是指一个类(子类)来继承另一个类(基类),并增加自己的功能,可以通过重写基类中的函数来实现.可以将继承理解成“IS A”的关系,比如A cat "IS A" animal, or A car "IS A" vehicl…
概要 Association, Aggregation and Composition are terms that represent relationships among objects. They are very basic stuff of Object Oriented Programming. 关联 Association is a relationship among the objects. Association is "*a*" relationship amo…