您的位置:首页 > 其它

Game Programming Gems 1中关于has a 和 is a的定义

2006-09-02 21:46 405 查看
The simple rule is this:If an object has an is-a relationship to another object,use public inheritance.If a has-a relationship describes the objects best,then use layering. What exactly do the term is-a and has -a mean?Pretty much exactly what they sound like.If we use them in a sentence,the meaning becomes clearer:

Class covette is -a type of class Car.

Class Corvette has-a type class Radio.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: