关于javatub丝袜的信息
本篇文章给大家谈谈javatub丝袜,以及对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。
本文目录一览:
java中 is - a和 has - a都是什么啊?
is-a 是继承关系。在继承关系中,一个子类继承于父类,其本身可以称之为父类。例如:狗继承于动物,可以说狗是一种动物。
has-a 是组成关系,在组成关系中,一个对象将一个或者多个其它对象作为自己的成员。
1. IS-A, HAS-A两种经典OO模式:
1.1 You can just use IS-A to figure out the relationship of Subclass and Superclass. If B is a A, that means class B extends class A. That's TRUE everywhere in the inheritance tree.
Example: Canine(犬科动物) is-A Animal, So Class Canine extends Animal; Wolf is-A Canine, So class wolf extends Canine; But note you can't change their position, Animal is-A Canine never happen, so class animal never extends Canine.
1.2 HAS-A, we can remember a case: Bathroom HAS-A Tub, Tub NEVER HAS-A Bathroom, that means class Bathroom has a instance variable(field) of class tub.
as we can see:
public class Bathroom()
{ private Tub tub;
Tub.flush(); }
public class Tub()
{ public void flush()
{ //more flush code here. } }
javatub丝袜的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于、javatub丝袜的信息别忘了在本站进行查找喔。