首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
In looking at the class structure of an entire system, we may find that its inheritance (1) is either wide and shallow, narrow a
In looking at the class structure of an entire system, we may find that its inheritance (1) is either wide and shallow, narrow a
admin
2009-09-04
29
问题
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、aggregation
B、inheritance
C、association
D、using
答案
B
解析
译文如下:在查看整个系统的类结构时,会发现它的继承层次或者是宽而浅,或者是窄而深,或者是均衡的。宽而浅的类结构通常表示一些可被混合和匹配的自由独立的类组成的类森林。窄而深的类结构,表示由公共的祖先相关联的类树。每种方法都有优缺点。类的森林的耦合度较低,但它们可能不能体现出存在的所有共同处。类树体现出这种共同处,所以它的类个体比类森林中的类要小。但是为了理解某个特定的类,通常需要理解它所继承的或使用的类的含义。类结构的形状是否恰当与特定问题紧密相关。我们必须在继承、聚合和使用这三个关系中选择使用合适的。例如,类Car是继承、还是包含、还是使用类Engine和类Wheel呢?在这种情况下,聚合关系比继承关系更合适。Meyer建议在类A和类B之间,“如果B的每个实例也可被看做A的一个实例,那么继承较为合适。如果B的每个实例只处理A的一个或多个属性,则客户关系更为合适一些”。从另外一个角度看,如果一个对象的行为多于它的单个部分的总和,那么在适当的类间创建聚合关系比继承关系更合适。
转载请注明原文地址:https://kaotiyun.com/show/erxZ777K
本试题收录于:
软件设计师上午基础知识考试题库软考中级分类
0
软件设计师上午基础知识考试
软考中级
相关试题推荐
PPP协议是数据链路层的一个协议,它被广泛用于接入Internet中。PPP协议是一个(53)。帧长为整数个字节。它克服了SLIP协议的缺点,可以进行协商,并且(54)。它可以分成3个层次,其中的网络层协议被称为(55),包括了不同的网络层协议。利用PPP
(12)是关于质量管理体系的一系列标准,有助于企业交付符合用户质量要求的产品。自标准实施之日起,至标准复审重新确认、修订或废止的时间,称为标准的有效期,我国在国家标准管理办法中规定,国家标准的有效期一般为(13)年。我国著作权法中对公民作品的发表权
为了进行差错控制,必须对传送的数据帧进行校验。在局域网中广泛使用的校验方法是(7)校验。CRC-16标准规定的生成多项式为G(x)=X16+X15+X2+1,它产生的校验码是(8)位,接收端发现错误后采取的措施是(9)。如果CRC的生成多项式为G(X)=X
Microsoft’sCOMisasoftwarearchitecturethatallowsapplicationstobebuiltfrombinarysoftwarecomponents.COMistheunde
将图中(1)和(2)空缺名称填写在答题纸对应的解答栏内。使ADSL的传输速率更高有哪两个主要因素?
Frame Relay is simplified form of(51), similar in principle to(52), in which synchronous, frames of data are routed to different
TheSimpleNetworkManagementProtocol(SNMP)isan(71)protocolthatfacilitatestheexchangeofmanagementinformationbetween(7
在某台路由器上定义了一条访问控制列表access-list109denyicmp10.1.10.100.0.255.255anyhost-unreachable,其含义是(51)。
BorderGatewayProtocol(BGP)isinter-autonomoussystem(71)protoc01.BGPisbasedonaroutingmethodcalledpathvectorrouting
The approach we propose is a system-oriented methodology for knowledge acquisition. This orientation emphasizes ongoing document
随机试题
在黑盒测试方法中,设计测试用例的主要依据是()。
知识产权在空间上的效力并不是无限的,它仅限于本国境内,这一特性表现的是知识产权的________特点()
A.近视B.老视C.远视D.散光视远物和近物均需眼调节的是
患者不幸在家中突发心绞痛时,最适宜用来抢救的硝酸甘油制剂是
男性,42岁,午饭后上腹剧痛4小时伴呕吐3次就诊。体温38.6℃,白细胞15×109/L。上腹部肌紧张及压痛,移动性浊音(+),血淀粉酶300U/L。初步诊断:急性胰腺炎。经治疗两周,体温仍持续在39℃以上。腹痛,腹胀,肠鸣音减弱,白细胞15×109/
证券交易机制涉及证券市场的微观结构,不同的证券交易市场可能会有不同的证券交易机制,但总的来说,以下不属于证券交易机制的目标的是( )。
通货膨胀的危害之一是,当物价水平持续性地普遍下降时,实际利率将会(),从而损害债务人的利益。
下列各项中,可以成为法律关系主体的有()。
【】是将信息资源的信息生产者、信息和信息技术三要素进行有机组合的一种途径或组织形式。
Iamhonoredtobeheretoday,(1)HarvardatthiscelebrationoftheCollegeBoard’shalfcenturyofworkingtopromote(2)and
最新回复
(
0
)