By http://hi.baidu.com/zhjunxue/blog/item/dc1082817f56a8d09123d981.html
Is a relationship between has
This is understandable.
A car is a vehicle.
A car has an engine: An has-a engine.
Is-A is generally an inheritance relationship.
Has-A is generally a composite relationship.
Or, you can understand it in this way;
"Has a" link is a composite link, implemented by defining class attributes; "is a" link is an inheritance link, implemented through class inheritance
If you are sure that the relationship between the two objects is-a, you should use inheritance. For example, diamond, circle, and square are both shapes, then they should all inherit from the shape class rather than aggregate.
If you determine the relationship between two objects is has-a, you should use a combination at this time. For example, a computer is composed of displays, CPUs, hard disks, etc, then you should combine the display, CPU, and hard disk categories into computer categories, instead of inheriting from the computer class.