Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Multiple inheritance
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|In software, to have several parent classes}} {{More citations needed|date=August 2012}} '''Multiple inheritance''' is a feature of some [[object-oriented programming|object-oriented]] computer [[programming language]]s in which an object or [[class (computer programming)|class]] can [[inheritance (object-oriented programming)|inherit]] features from more than one parent object or [[superclass (computer science)|parent class]]. It is distinct from single inheritance, where an object or class may only inherit from one particular object or class. Multiple inheritance has been a controversial issue for many years,<ref>{{cite journal |last=Cargill |first=T. A. |date=Winter 1991 |title=Controversy: The Case Against Multiple Inheritance in C++ |journal=Computing Systems |volume=4 |number=1 |pages=69–82}}</ref><ref>{{cite journal |last=Waldo |first=Jim |date=Spring 1991 |title=Controversy: The Case For Multiple Inheritance in C++ |journal=Computing Systems |volume=4 |number=2 |pages=157–171}}</ref> with opponents pointing to its increased complexity and ambiguity in situations such as the "diamond problem", where it may be ambiguous as to which parent class a particular feature is inherited from if more than one parent class implements said feature. This can be addressed in various ways, including using [[virtual inheritance]].<ref>{{cite web |last1=Schärli |first1=Nathanael |last2=Ducasse |first2=Stéphane |last3=Nierstrasz |first3=Oscar |last4=Black |first4=Andrew |title=Traits: Composable Units of Behavior |website=Web.cecs.pdx.edu |url=http://web.cecs.pdx.edu/~black/publications/TR_CSE_02-012.pdf |format=PDF |access-date=2016-10-21}}</ref> Alternate methods of [[object composition]] not based on inheritance such as [[mixin]]s and [[trait (computer programming)|traits]] have also been proposed to address the ambiguity.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)