首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
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
41
问题
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
软件设计师上午基础知识考试
软考中级
相关试题推荐
ISDN是在(58)基础上建立起来的网络,能够提供的最高速率(59)。常用的有D和B两种标准化信道,其中D信道主要用来传输(60)。使用基本速率接口传输声音,一路话音占用的数据传输率是(61),占总带宽的比例是(62)。
PPP协议是数据链路层的一个协议,它被广泛用于接入Internet中。PPP协议是一个(53)。帧长为整数个字节。它克服了SLIP协议的缺点,可以进行协商,并且(54)。它可以分成3个层次,其中的网络层协议被称为(55),包括了不同的网络层协议。利用PPP
输入/输出系统主要用三种方式与主机交换数据,对于这三种方式的描述正确的是(1)。
在下列选项中,(5)是将网络方法用于工作计划安排的评审和检查的项目管理工具。
ISDN相对传统电信网有哪些优点?在路由器和ISDN之间需要加入终端适配器(TA)吗?试说明在什么情况下需要加入TA。
在应用服务器关机的情况下,公司员工能连接上Internet吗?简要解释。假设采用ISDN基本速率接口,下载1875K的文件,最快需要多少秒?
对欲访问特定信息的发起者的身份或者对传送的报文完整性进行合法性审查或核实的行为称为(50)。在日常生活中,我们可以用手写签名来防止否认的发生。在计算机通信中,要解决这类问题,可采用的方法是(51)。关于客户/服务器应用模式,说法正确的是(52)。在理论上,
TheBorderGatewayProtocol(BGP)isaninterautonomoussystem(6)protocol.TheprimaryfunctionofaBGPspeakingsystemistoex
Althoughagivenwaveformmaycontainfrequenciesoveraverybroadrange.asapracticalmatteranytransmissionsystemwillbe
Althoughagivenwaveformmaycontainfrequenciesoveraverybroadrange.asapracticalmatteranytransmissionsystemwillbe
随机试题
患儿女性,8岁。左侧面部抽动2个月余,表现为左侧口角、左眼抽动,无意识障碍,抽动持续十余秒,可自行缓解。既往有吃“烧烤”史。查体:发育正常,营养中等,全身皮肤未发现皮下囊肿,心肺腹部检查未见异常。神经系统检查:神志清楚,思维反应稍迟钝,眼底视盘边界欠清,四
疑为霍乱/副溶血弧菌引起的腹泻,所采集的粪便应置于何种培养基
中焦病证可见下焦病证可见
华康公司的净资产是否符合发行公司债券的条件?为什么?该公司本想发行股票,但因不完全具备发行股票的条件,想发行可转换为股票的公司债券,这一愿望能否实现?
下列选项中,属于我国目前实行的信贷政策内容的有()
甲上市公司自资产负债表日至财务报告批准报出日之间发生的下列事项中,属于资产负债表日后非调整事项的有()。
2000一2008年,全国民政事业基本建设累计完成投资总额为多少亿元?
求a,b及可逆矩阵P,使得P-1AP=B.
ときどき驚が来てくれるのである。来るとすぐ分かる。ひらっひらっとした鋭い羽使いが特有だからである。大きさは雀と同じくらいだし、衣装も地味なのを着ているから、葉陰にじっとしておられると、見間違えるけれど、【R5】________たちまち分かる。障子に映った
Areplywillbesentwithinthenextfewdaysalongwith______apology.
最新回复
(
0
)