请输入您要查询的百科知识:

 

词条 单根层次结构
释义

Singly rooted hierarchy单根层次结构

he singly-rooted hierarchy, in object-oriented programming, is a characteristic of most (but not all) OOP-based programming languages. In most such languages, in fact, all classes inherit directly or indirectly from a single root, usually with a name similar to Object; all classes then form a common inheritance hierarchy.

单根层次结构,在面向对象编程中(但不是全部)最为典型。在大多数编程语言里,事实上,所有类直接或间接继承自一个根(单根),通常使用一个名称类似Object,所有的类,然后形成一个共同继承层次结构。

This idea was introduced first by Smalltalk, the first OOP language, and was since used in most other ones (notably Java and C#).

Smalltalk首先提出这个想法和观点,在第一个面向对象的语言里,在其他很多编程语言里也在用这个概念(特别是Java和C#)。

A notable exception is C++, where (mainly for compatibility with C and efficiency) there is no single object hierarchy. This feature is especially useful for container libraries - they only need to allow putting an Object in a container to allow objects of any class to be put in the container. Containers in C++ have been implemented with multiple inheritance, and with help of template-based generic programming by Bjarne Stroustrup.

一个显著的例外是在C + +中,其中(主要是为了与C兼容和提高效率)不存在单一的对象层次结构。 此功能是特别有用的(集装箱?)函式库-他们只需要放在一个(函式库?容器?)Object 里,允许函式库任何类的对象去请求执行。 由Bjarne Stroustrup在C ++容器已实现应用执行和多重继承,并与帮助模板为基础的通用编程。

随便看

 

百科全书收录4421916条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。

 

Copyright © 2004-2023 Cnenc.net All Rights Reserved
更新时间:2025/3/21 4:42:08