class Chinese { private yellowskin; }class OverSeaChinese extends Chinese { private livingcountry; }OverSeaChinese "is a " Chinese, Both Chinese and OverseaChinese "has a" yellowskin, OverSeaChinese "has a" attribute of livingcountry.
各位: 我明白了,如下:男人 is a 人 男人 has a 胡须
a是什么说明a是什么类的对象; a有什么说明a这个对象具有什么属性或方法。
is a 是继承的关系,has a是属性的关系(类和类成员的关系)
这是面向对象里面的两个概念: is a表示继承关系 has a表示组成聚合关系如果要判断,有一种简单的方法就是用"is a kind of"和"has a"来套! 男人is a kind of 人 汽车has (个数)轮子
{
private yellowskin;
}class OverSeaChinese extends Chinese
{
private livingcountry;
}OverSeaChinese "is a " Chinese, Both Chinese and OverseaChinese "has a" yellowskin, OverSeaChinese "has a" attribute of livingcountry.
我明白了,如下:男人 is a 人
男人 has a 胡须
a有什么说明a这个对象具有什么属性或方法。
is a表示继承关系
has a表示组成聚合关系如果要判断,有一种简单的方法就是用"is a kind of"和"has a"来套!
男人is a kind of 人
汽车has (个数)轮子