首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
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
27
问题
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://jikaoti.com/ti/uVa7FFFM
本试题收录于:
软件设计师上午基础知识考试题库软考中级分类
0
软件设计师上午基础知识考试
软考中级
相关试题推荐
A向B发送消息P,并使用公钥体制进行数字签名。设E表示公钥,D表示私钥,则B要保留的证据是(5)。基于数论原理的RSA算法的安全性建立在(6)的基础上。Kerberos是MIT为校园网设计的身份认证系统,该系统利用智能卡产生(7)密钥,可以防止窃听者捕获认
系统测试是将软件系统与硬件、外设和网络等其他因素结合,对整个软件系统进行测试。(12)不是系统测试的内容。
为了进行差错控制,必须对传送的数据帧进行校验。在局域网中广泛使用的校验方法是(7)校验。CRC-16标准规定的生成多项式为G(x)=X16+X15+X2+1,它产生的校验码是(8)位,接收端发现错误后采取的措施是(9)。如果CRC的生成多项式为G(X)=X
项目管理工具中,将网络方法用于工作计划安排的评审和检查的是(7)。
Networkmanagershavelongawaitedpracticalvoice-over-IP(VOIP)solutions.VOIPpromiseseasenetworkmanagementanddecreases(6
目前,国内短消息服务平台按照接入方式主要可分为哪两种?请简要说出网关服务器与短消息服务过程。
FrameRelayissimplifiedformof(71),similarinprincipleto(72),inwhichsynchronous,framesofdataareroutedtodifferent
04B/5B编码是一种两级编码方案,首先要把数据变成(13)编码,再把4位分为一组的代码变换成5单位的代码。这种编码的效率是()。
我国注册商标的保护期限是(4)。
BorderGatewayProtocol(BGP)isinter-autonomoussystem(71)protoc01.BGPisbasedonaroutingmethodcalledpathvectorrouting
随机试题
下列各项中,符合印花税有关法律规定的有()。
小婴儿化脓性脑膜炎,脑膜刺激征不明显是由于
上颌第一磨牙舌面近中舌尖与远中舌尖之间的沟称为
能诱导细胞膜上Na +-K+ATP酶生成的是能使氧化与磷酸化偶联过程脱离的是
政策性银行与商业性金融机构的最显著不同在于()。
学校对教师考核的内容包括思想道德品质、业务水平,其中业务水平作为评定的重要依据。()
外出务工农民的土地承包经营权如何保护?
2013年我国货物进出口总额比2009年增长:
Anewstudyofthebrainishelpingscientistsbetterunderstandhowhumansprocesslanguage.Oneofthepatientsisawomanwit
Market【C1】______donotcomenaturallytoChineseofficials.Forthepastfouryearstwohugediversion【C2】______havebeenunde
最新回复
(
0
)