单根层次结构

王朝百科·作者佚名  2012-04-23  
宽屏版  字体: |||超大  

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 ++容器已实现应用执行和多重继承,并与帮助模板为基础的通用编程。

 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
© 2005- 王朝百科 版权所有