首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
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
34
问题
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
软件设计师上午基础知识考试
软考中级
相关试题推荐
TCP通过建立连接为用户提供可靠传输,与数据链路层的连接建立不同,TCP要经过(58)才能确定一个连接,这是因为(59)。TCP采用的差错控制也是超时重发技术,超时时间的设置采用—(60)策略,以便适应互联网的特性。超时时间设置根据的是(61)。TCP的拥
基于TCP/IP的互联网服务中,IP协议提供主机之间的(42)分组传输服务。TCP协议提供端口之间的(43)文传输服务;U-DP属于(44)协议,从其下一层接收了数据以后,根据(45)将之分解咸UDP数据报;应用层的(46)协议可以使用UDP或TCP协议传
SNMPc是一个通用的多用户分布式网络管理平台,采用(21)轮询机制,具有高度的可伸缩性。假设有一个局域网,管理站每15分钟轮询被管理设备一次,一次查询访问需要的时间是200ms,则管理站最多可以支持(22)台网络设备。
SNMPc是一个通用的多用户分布式网络管理平台,采用(21)轮询机制,具有高度的可伸缩性。假设有一个局域网,管理站每15分钟轮询被管理设备一次,一次查询访问需要的时间是200ms,则管理站最多可以支持(22)台网络设备。
Networkmanagershavelongawaitedpracticalvoice-over-IP(VOIP)solutions.VOIPpromiseseasenetworkmanagementanddecreases(6
虚拟存储,就是把多个存储介质模块(如硬盘、RAID)通过一定的手段集中管理起来,所有的存储模块在一个存储池(StoragePool)中得到统一管理。虚拟存储管理系统是以程序的(5)理论为基础的,其基本含义是指程序执行时往往会不均匀地访问主存储器单元。根据
某单位有一个100台机器的大机房,要实现每一台计算机都上网,一般认为,用代理是一个办法,但是工作量比较大,要为每一台机器分别安装客户端软件,而且还要设置IP地址、网关、DNS服务器等。此外,还有一个不错的方法,那就是建立NAT服务器,在服务器上配置DNS和
对欲访问特定信息的发起者的身份或者对传送的报文完整性进行合法性审查或核实的行为称为(50)。在日常生活中,我们可以用手写签名来防止否认的发生。在计算机通信中,要解决这类问题,可采用的方法是(51)。关于客户/服务器应用模式,说法正确的是(52)。在理论上,
VirtualizationisanapproachtoITthatpoolsandshares(1)sothatutilizationisoptimizedandsuppliesautomaticallymeetd
VirtualizationisanapproachtoITthatpoolsandshares(1)sothatutilizationisoptimizedandsuppliesautomaticallymeetd
随机试题
试述讨价还价过程中应注意的原则。
领导者按照决策及其实施计划组织人力、财力、物力,协调它们之间的关系,实现管理目标的能力是()
分类属于数模混合网的是()。
某化学品厂建造项目,主要设计的工程包括:药剂生产线、循环冷却水站、配电供电系统、供水排水管网、氨吸收塔、氯气吸收塔、工艺及热力外管廊、焚烧炉、活性炭吸附设施等。生产原料为含有害和恶臭的化学品。工程附近有居民区和风景区,靠近长江,评价区大气环境质量较好,附近
发生法律责任的原因可能是多方面的,但主要是()和()的责任。
一个工作部门会出现多个矛盾指令源的项目组织结构是()。
()不宜作为股份有限公司的发起人。
(中央财经大学2010年复试真题)刘某将自有住房无偿赠与非法定继承人王某,已向税务机关提交经审核并签字盖章的“个人无偿赠与不动产登记表”。下列有关刘某赠房涉及税收的表述中,正确的有()。
Inordertoworkheretheforeignerneedsaworkpermit,whichmustbeapplied【C1】______byhisprospectiveemployer.Theprobl
A、Tomakefulluseofthemetalsleft.B、Toprotecttheforestresourcesfrombeingdestroyed.C、Tocallforstoppingusingplas
最新回复
(
0
)