
继承层次;继承体系;继承阶层架构
The root class of an inheritance hierarchy should define a virtual destructor even if the destructor has no work to do.
继承层次关系的根类应该定义虚函数性质的析构函数,即使这个析构函数不做任何的事情。
A global aspect utilizing a signature pattern based on packages and the inheritance hierarchy would serve you better in this situation.
在这种情况下,利用基于包和继承层次结构的签名模式的全局方面可以做得更好。
That's because objects in the real world just don't fit into a ****** single inheritance hierarchy.
那是因为实际世界中的对象不会刚好适合一个简单的单继承层次结构。
At the top of Listing 4, you see a nested module definition. A module has method definitions, but no base inheritance hierarchy.
在 清单 4 的顶部,可以看到一个嵌套的模块定义,但是没有基继承层次结构。
If you would like to rename this method, a check of all classes in the inheritance hierarchy is needed to find all positions in the code which should be changed.
如果你要重命名这个方法,必须检查继承层次中的所有类,以找到应该做出改变的所有位置。
Instead, we'd either have to copy code along multiple paths in the inheritance hierarchy or employ the Strategy pattern (or some other trick using containment) to avoid copying code.
另一种方法是,我们要么必须沿着继承层次结构中的多条路径复制代码,要么使用策略模式(或其它使用限制的一些诀窍)来避免复制代码。
An inheritance hierarchy is a way of organizing a set of abstractions from most general to least general.
继承的层次是从最多到最少的概要(共性)中构建一组抽象的方法。
If you have an inheritance hierarchy that is too broad, inheritance will break down.
如果已有的继承等级非常宽,继承就会失效。
The assertion fails if there exists one element in the collection for which the specified type is not found in its inheritance hierarchy.
判断提示失败,如果那里存在的集合中之指定的型别中找不到其继承阶层架构中的一个项目。
Finalization must be propagated through the inheritance hierarchy.
终止必须通过继承层次结构传播。
Gets the name of the management class in which the method was first introduced in the class inheritance hierarchy.
获取管理类的名称,在该类中第一次将该方法引入到类的继承层次结构。
The assertion fails if the type is found in the inheritance hierarchy of the object.
如果此型别位于物件的继承阶层架构内,判断提示就会失败。
Classes in the same inheritance hierarchy typically belong in the same package.
一般位于同一继承层次上的类也属于同一个包。
The Template Method pattern suggests that I should move common boilerplate code up the inheritance hierarchy, deferring algorithmic details to child classes.
TemplateMethod模式建议,应当将公共模板代码移到继承层次结构之上,将算法细节推迟到子类。
Knowledge base is based on Common Information Model (CIM): reasoning rules in Knowledge base have inheritance hierarchy, just as device classes in CIM do;
知识库充分结合国际标准的CIM模型,依照CIM模型中的设备继承层次结构,建立推理规则的层次结构;
The standard MBeans convention would make the interfaces depend on the implementations and represents a needless duplication of the inheritance hierarchy for this system.
标准MBean 的约定使得接口依赖于实现,而且代表这个系统的继承层次出现不必要的重复。
A class's members include all the members declared in the class, along with all members (except constructors and destructors) declared in all classes in its inheritance hierarchy.
类的成员包括在类中声明的所有成员,以及在该类的继承层次结构中的所有类中声明的所有成员(构造函数和析构函数除外)。
Conceptually, we can think of the inheritance hierarchy as defining a search technique for methods and variables.
理论上,我们认为继承阶层是作为定义方法和可变物质的一个查寻技术。
To understand why, we need to look a little closer as to what exactly is necessary to support adding methods and fields (and even more advanced, changing the inheritance hierarchy).
为了理解这其中的原因,我们需要稍微靠近一点看一看,到底是需要用什么来支持方法和域的添加操作(甚至更深入一些,修改继承的层次结构)。
We need two new Classes at either end of the inheritance hierarchy to do this.
在继承层次的每个端点,我们需要两个新类来完成这个。
Traditional object-oriented programming, especially in languages like Python that allow multiple inheritance, attempt to modularize concerns with an inheritance hierarchy.
传统的面向对象编程,尤其是在诸如Python之类允许多重继承的语言中,都会试图使用一个继承层次结构来模块化关注事项。
Listing 4 shows how you might use the declare parents tag to change Foo's inheritance hierarchy.
清单4显示了用declareparents标签来改变Foo的继承层次。
However, this would make test case classes difficult to reuse between test types, because the test type decision is made near the root of the inheritance hierarchy;
但是,这会使测试环境类在测试类型中难以再利用,因为测试类型的决定是在靠近继承层次的根部作出的;
Just look at the Java class hierarchy to see an elaborate set of object inheritance hierarchy.
仅仅查看Java类就可以看到一组精巧的对象继承层次结构。
In other words, a complete inheritance hierarchy is stored in a single database table.
换言之,整个继承层次结构存储在单个数据库表中。
A constructor for the base class is always called during the construction process for a derived class, chaining up the inheritance hierarchy so that a constructor for every base class is called.
一个基类的构造方法在它的派生类的对象创建过程中是会被调用的,根据继承关系图一层层追溯,所有基类的构造方法都会被调用的。
在面向对象编程(OOP)中,inheritance hierarchy(继承层次结构) 指通过类与类之间的继承关系形成的树状结构。这种结构以基类(父类)为起点,逐层派生出更具体的子类,体现代码复用和逻辑分层的特点。
继承(Inheritance)
继承允许子类复用父类的属性和方法,同时可扩展或重写功能。例如,在Java中,若父类Animal
定义了eat
方法,子类Dog
可直接继承该方法,或通过重写实现特定行为。
层次结构(Hierarchy)
层次结构表现为类的纵向分层。例如,父类Vehicle
可派生子类Car
和Bicycle
,而Car
又可进一步派生出ElectricCar
和GasolineCar
,形成多层关系。微软的C#文档指出,这种结构能清晰反映现实世界的分类逻辑。
在编程中,继承层次结构常用于建模领域知识。例如,图形界面库可能包含基类UIComponent
,子类Button
和TextField
继承其基础属性,而Button
又可细分为Checkbox
和RadioButton
。GeeksforGeeks的技术文章通过代码示例展示了这种分层设计如何提升代码可维护性。
"inheritance hierarchy"(继承层次结构)是面向对象编程(OOP)中的核心概念,指通过继承关系形成的类与类之间的树状结构。以下是详细解释:
定义与结构
核心作用
常见类型
设计原则
相关概念
继承层次结构广泛应用于框架设计(如Java集合框架、GUI组件库)和业务建模(如电商系统的订单体系)。合理设计层次结构能提升代码可维护性,但需注意避免"脆弱基类"等问题。
【别人正在浏览】