In looking at the class structure of an entire system, we may find that its inheritance (1) is either wide and shallow, narrow and deep, or balanced. Class structures that are wide and shallow usually represent forests of (2) classes that can be mixed and

题目

In looking at the class structure of an entire system, we may find that its inheritance (1) is either wide and shallow, narrow and deep, or balanced. Class structures that are wide and shallow usually represent forests of (2) classes that can be mixed and matched. Class structures that are narrow and deep represent trees of classes that are related by a common ancestor. There are advantages and disadvantages to each approach. Forests of classes are more loosely (3) , but they may not exploit all the commonality that exists. Trees of classes exploit this commonality, so that individual classes are smaller than in forests. However, to understand a particular class, it is usually necessary to understand the meaning of all the classes it inherits from or uses. The proper shape of a class structure is highly problem-dependent. We must make similar trade-offs among inheritance, aggregation, and using relation- ships. For example, should the class Car inherit, contain, or use the classes named Engine and Wheel? In this case, we suggest that an (4) relationship is more appropriate than inheritance relationship. Meyer states that between the class A and B," (5) is appropriate if every instance of B may also be viewed as an instance of A. The client relationship is appropriate when every instance of B simply possesses one or more attributes of A". From another perspective, if the behavior. of an object is more than the sum of its individual parts, then creating an aggregation relationship rather than an inheritance relationship between the appropriate classes is probably superior.

A.distinction

B.level

C.grade

D.hierarchy


相似考题
更多“In looking at the class structure of an entire system, we may find that its inheritance (1 ”相关问题
  • 第1题:

    44、第三方库bs4中,find_all() 方法find_all(name , attrs , recursive , string , **kwargs ) 如果想查找只符合某一个条件的特定标签内容,可以结合使用name、attrs两个参数, attrs 参数定义一个字典参数来搜索包含特殊属性的tag。如下所示: find_all(name="p",attrs={"class": "tem"}) 是将<p>标签中,属性为class,属性class的值为“tem”的那一组(或一个)<p>标签。


    ['3','1']

  • 第2题:

    阅读下列代码,选出该代码段正确的文件名()。 class A{ void method1(){ System.out.println("Method1 in class A"); } } public class B{ void method2(){ System.out.println("Method2 in class B"); } public static void main(String[] args){ System.out.println("main() in class B"); } }

    A.java

    B.A.class

    C.B.java

    D.B.class


    D解析:while的循环控制条件可以为“true”,run方法没有返回值,所以不能是int型,故此程

  • 第3题:

    7、查找城市天气数据时,若要使用BeautifulSoup中的find()方法,则可以使用网页标签及标签属性来定位到对应的数据。例如:soup.find('p', class_="tem").text


    分析病情

  • 第4题:

    下面英文日期写法错误的是____?

    A.May 1, 2015

    B.1 May,2015

    C.1 May 2015

    D.May 1st, 2015


    10 Oct.,2015

  • 第5题:

    真核生物ITS序列由ITS1和ITS2两部分组成。


    编码序列

  • 第6题:

    如下 java程序对应的程序文件名为为 public class DemoProgram2_1 { public static void main(String[] args) { System.out.println("hello world!"); } }

    A.DemoProgram2_1

    B.DemoProgram2_1.java

    C.DemoProgram.java

    D.DemoProgram2_1 .class


    javac.exe