首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
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
25
问题
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
软件设计师上午基础知识考试
软考中级
相关试题推荐
单个磁头在向盘片的磁性涂层上写入数据时,是以(6)方式写入的。
Networkscanbeinterconnectedbydifferentdevices.Inthephysicallayer,networkscanbeconnectedby(66)orHubs,whichjust
Microsoft’sCOMisasoftwarearchitecturethatallowsapplicationstobebuiltfrombinarysoftwarecomponents.COMistheunde
CMM(软件能力成熟度模型)描述和分析了软件过程能力的发展与改进的程度,确立了一个软件过程成熟程度的分级标准。在初始级,软件过程定义几乎处于无章可循的状态,软件产品的成功往往依赖于个人的努力和机遇;在(44),已建立了基本的项目管理过程,可对成本、进度和功
阅读以下说明,回答下面问题。【说明】在atm(asynchronoustransfermode)传输模式中,信息被组织成信元,因包含来自某用户信息的各个信元不需要周期性出现,这种传输模式是异步的。由于atm技术简化了交换过程,去处了不必要
子网过滤防火墙安装方法是把防火墙安装在一个由(1)控制边界的公共子网中,子网中有一台执行(2)的主机,对于多数应用入口,需要一个附加的(3)机制来控制、筛选入口与网络之间的信息流。这样可以有效地把该机制和(4)结合起来,达到多层屏障保护的目的。
TheBorderGatewayProtocol(BGP)isaninterautonomoussystem(6)protocol.TheprimaryfunctionofaBGPspeakingsystemistoex
X、Y为逻辑变量,与逻辑表达式X+XY等价的是____________。
通过该程序的算法用等价类设计测试用例,检查逻辑覆盖标准。用边界值分析法设计测试用例,检查逻辑覆盖标准。
Virtualization is an approach to IT that pools and shares(71)so that utilization is optimized and supplies automatically meet de
随机试题
违反治安管理的行为属于行政违法行为,犯罪行为是刑事违法行为。()
简述沟通的原则和要求。
心房扑动的心电图特点为
急性有机磷农药中毒最主要的死因是
下列关于经济增长方式的叙述中正确的是()。
声发射涡流探测法都()。
税务师受托为某建材商行编制2019年7月的增值税纳税申报表,建材商行系增值税一般纳税人,主营各类洁具的批发零售。已知建材商行当月增值税专用发票和机动车销售统一发票已通过增值税发票查询平台勾选确认或认证,2019年6月增值税纳税申报时,留抵税额为0元。无待抵
根据企业所得税法律制度的有关规定,下列各项中,属于计算企业应纳税所得额时准予扣除的项目有( )。
1939年10月,毛泽东发表《(共产党人)发刊词》一文,该文中被毛泽东豪迈地称之为“伟大的工程”的是()。
Musicistheresultofthoughtintheformofattitude.Thereisnoonewayofthinking,sincemen’svaluesareasscatteredand
最新回复
(
0
)