單根層次結構

簡介,結構來源,

簡介

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 ++容器已實現套用執行和多重繼承,並與幫助模板為基礎的通用編程。

相關詞條

熱門詞條

聯絡我們