首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
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
49
问题
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
软件设计师上午基础知识考试
软考中级
相关试题推荐
若指令流水线把一条指令分为取指、分析和执行3部分,且3部分的时间分别是t取指=2ns,t分析=2ns,t执行=1.5ns。则100条指令全部执行完毕需(4)ns。
两个码子之间的海明距为(22)。码是由码子组成的集合,一个码的海明距离指的是(23)。若一个码要求检测3位错,则该码的海明距离应为,(24)。
若信号带宽为40Hz,理想信道可以达到的最大码元速率为(17)。若码元可以取8种离散值,则一个码元携带的信息量为(18)比特,此时,理想信道传输信号带宽为40Hz的数据速率为(19)。
为了进行差错控制,必须对传送的数据帧进行校验。在局域网中广泛使用的校验方法是(7)校验。CRC-16标准规定的生成多项式为G(x)=X16+X15+X2+1,它产生的校验码是(8)位,接收端发现错误后采取的措施是(9)。如果CRC的生成多项式为G(X)=X
两个人利用Netphone通话时,对语言格式的解释是由(19)完成的。
在CSMA中,决定退让时间的算法如下(1)如果信道空闲,则以P的概率发送,而以1-P的概率延迟一个时间单位to(2)如果信道忙,则继续监听直至信道空闲并重复步骤(1)。(3)如果发送延迟了一个时间单位t,则重复步骤(1)。上
简述什么是ISDN?依据ISO/OSI参考模型对无线扩频网络设备进行分类,可以分为哪几种类型?用无线扩频设备实现网络互连需要何种配套设备?
阅读下列程序说明和C代码,填入(n)处。【说明】幼儿园有n(<20)个孩子围成一圈分糖果。老师先随机地发给每个孩子若干颗糖果,然后按以下规则调整:每个孩子同时将自己手中的糖果分一半给坐在他右边的小朋友。如共有8个孩子,则第1个
Networks can be interconnected by different devices in the physical layer networks can be connected by(1)or hubs. Which just mov
BorderGatewayProtocol(BGP)isinter-autonomoussystem(71)protoc01.BGPisbasedonaroutingmethodcalledpathvectorrouting
随机试题
局部兴奋()。
谈静朱光潜人生乐趣一半得之于活动,也还有一半得之于感受。所谓“感受"是被动的,是容许自然界事物感动我的感官和心灵。这两个字含义极广。眼见颜
在工程开工前,总监理工程师应组织专业监理工程师审查承包单位报送的施工组织设计(方案)报审表,提出意见,并经()审核、答认后报建设单位。
以下国际结算方式中,属于顺汇的是()
甲公司是ABC会计师事务所的常年审计客户。A注册会计师负责审计甲公司2013年度财务报表,确定财务报表整体的重要性为240万元。 资料一: A注册会计师在审计工作底稿中记录了所了解的甲公司情况及其环境,部分内容摘录如下: (1)甲公司原租用的办公楼月
储位指派原则包括()。
【2014.广西】教师的教育教学任务较为繁重,“以分数论学生,以升学率论教师”的现象仍然存在:有的学校管理混乱,教师与领导沟通不畅,教师常常处于应付教学活动的状态,因而导致教师心情烦躁、易怒、情绪紧张。此材料说明造成教师这种压力的原因是()。
周末,某咨询公司举办了一场规模盛大的人力资源论坛,所有曾经与该公司合作过的人力资源工作者都出席了本次论坛。中业电气的甲出席了本次论坛,因此,中业电气曾经与该咨询公司合作过。以下哪项最能有力地削弱上述论断?
设A是m×n矩阵,如果齐次方程组Aχ=0的解全是方程b1χ1+b2χ2+…+bnχn=0的解,证明向量β=(b1,b2,…,bn)可由A的行向量线性表出.
A、Peoplewithhighdiplomas.B、Peoplewithgoodsalaries.C、Peoplevaluabletothegrossnationalproduct.D、Peoplespecialized
最新回复
(
0
)