首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
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
56
问题
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
软件设计师上午基础知识考试
软考中级
相关试题推荐
FTP是基于(39)实现的文件传输协议,使用此协议进行文件传输时,FTP客户和服务器之间建立的连接是(40)。
RS-232-C是目前常见的一种接口标准,它是由(32)提供制定的。该标准在OSI模型中属于(33)层协议标准,通过RS-232-C来连接两个设备最少要连接(34)条线。这个标准的设计数据速率是处理(35)bit/s。(35)bit/s条件下,采用RS-4
一般认为决定局域网特性的主要技术有三个,它们是(20)。
CMM(软件能力成熟度模型)描述和分析了软件过程能力的发展与改进的程度,确立了一个软件过程成熟程度的分级标准。在初始级,软件过程定义几乎处于无章可循的状态,软件产品的成功往往依赖于个人的努力和机遇;在(44),已建立了基本的项目管理过程,可对成本、进度和功
程序的(39)理论是虚拟存储管理系统的基础。根据这个理论,Denning又提出了工作集理论。工作集是进程运行时被频繁地访问的页面集合。在进程运行时,如果它的工作集页面都在(40)内,能够使该进程有效地运行,否则会出现频繁的页面调入/调出现象。
某企业的网络拓扑结构如图2.2所示,采用VPN来实现网络安全。请简要叙述从企业总部主机到分支机构主机通过IPsec的通信过程。在进行远程登陆时,最好使用哪种方式(IPSecVPN和SSLVPN)?
对欲访问特定信息的发起者的身份或者对传送的报文完整性进行合法性审查或核实的行为称为(50)。在日常生活中,我们可以用手写签名来防止否认的发生。在计算机通信中,要解决这类问题,可采用的方法是(51)。关于客户/服务器应用模式,说法正确的是(52)。在理论上,
在某台路由器上定义了一条访问控制列表access-list109denyicmp10.1.10.100.0.255.255anyhost-unreachable,其含义是(51)。
在设计测试用例时,(41)是用得最多的一种黑盒测试方法。在黑盒测试方法中,等价类划分方法设计测试用例的步骤是:①根据输入条件把数目极多的输入数据划分成若十个有效等价类和若干个无效等价类。②设计一个测试用例,使其覆盖(42)尚未被覆盖的有效等
随机试题
文学史上“风骚”并称,其中“风”指《国风》,“骚”指《离骚》。()
火灾报警控制器仅在同一个探测区内()部位均被屏蔽的情况下,才能显示该探测区被屏蔽,否则只能显示被屏蔽部位。
患者,女性,35岁,骑电动车不慎摔伤,致左下肢胫腓骨粉碎性骨折,给予患者外固定架手术治疗。患者体型胖,住院1个月后出现伤口脂肪液化。患者因卧床时间长,担心愈后。下列哪项不是术后功能锻炼的目的
关于侦查期间辩护人的权利,下列说法正确的是?
依据《道路交通安全法》的规定,仿造、变造或者使用仿造、变造的驾驶证的,由公安机关交通管理部门予以()的处罚。
收入型证券组合追求()的最大化。
从其他工商企业购进的已税时,生产耗用的外购应税消费品的已纳消费税税款准予扣除。()
张某因盗窃被判处有期徒刑5年,在交付执行前,突患严重疾病,需保外就医。有权决定张某暂予监外执行的是哪一个机关?()
二次型f(x1,x2,x3)=(x1+3x2+ax3)(x1+5x2+bx31)的负惯性指数等于().
Thepoliceaccusedhim________settingfiretothebuildingbuthefirmlydenied________intheareaonthenightofthefire.
最新回复
(
0
)