现实生活中,所有具有一定属性的名词,例如,student teacher collage都可定义为一个类class。对象就是存在具体的实例,例如 teacher 他的sex age work profession and so on,
这些是他的属性,he can teach us ,talk with us ,his thought can influence us,this is his action.综上,对象有且仅有两个基本点 属性和行为。
for example :
public class teacher{}(定义一个teacher的class)
public String name;
public int age;(nature)
public void teach (bandit b){}(action)
opp class (类),object(对象)
猜你喜欢
转载自xuyi1994.iteye.com/blog/1820572
今日推荐
周排行