
File:Single_Inheritance.jpg · Wikimedia Commons · See Wikimedia Commons
Also known as subclassing, subclass relationship, superclass and subclass, base and derived classes
concept in object-oriented programming
In the Vinony graph
Within Vinony's link graph, 继承 is referenced by 327 other articles, and connects out to multiple inheritance, class and type conversion.
It sits within the topics Cleanup tagged articles with a reason field from April 2015, Object-oriented programming and Type systems.
Its subject is documented across 40 Wikipedia language editions.
Wikidata facts
- Instance of
- concept
- Subclass of
- relation
- Part of
- object-oriented programming
- Has use
- subtyping
Show 3 more facts
- partially coincident with
- subtyping
- Stack Exchange tag
- stackoverflow.com/tags/inheritance
- facet of
- object-oriented programming
Sources (2)
via Wikidata · CC0
Article · 中文
继承(英語:inheritance)是面向对象软件技术当中的一个概念。如果一个类別B「继承自」另一个类別A,就把这个B称为「A的子类」,而把A称为「B的父类別」也可以称「A是B的超类」。继承可以使得子类具有父类別的各种属性和方法,而不需要再次编写相同的代码。在令子类別继承父类別的同时,可以重新定义某些属性,并重写某些方法,即覆盖父类別的原有属性和方法,使其获得与父类別不同的功能。另外,为子类追加新的属性和方法也是常见的做法。一般靜態的物件導向程式語言,繼承屬於靜態的,意即在子類別的行為在編譯期就已經決定,無法在執行期擴充。 有些编程语言支持多重继承,即一个子类可以同时有多个父類別,比如C++编程语言;而在有些编程语言中,一个子類只能继承自一个父類別,比如Java编程语言,这时可以透過實作接口来实现与多重继承相似的效果。 現今物件導向程式設計技巧中,繼承並非以繼承類別的「行為」為主,而是繼承類別的「型態」,使得元件的型態一致。另外在設計模式中提到一個守則,「多用合成,少用繼承」,此守則也是用來處理繼承無法在執行期動態擴充行為的遺憾。
Abstract from DBpedia / Wikipedia · CC BY-SA