Computer >> Computer tutorials >  >> Programming >> Javascript

Multiple inheritance in JavaScript


In multiple inheritence, an object can inherit the properties and values from unrelated parent objects. Some object-oriented languages allow multiple inheritance. JavaScript does not support multiple inheritance.

Inheritance of property values occurs at run time by JavaScript searching the prototype chain of an object to find a value. Since every object has a single associated prototype, it cannot dynamically inherit from more than one prototype chain.

There are workarounds to make multiple inheritence work in JS. You can find examples of these at https://stackoverflow.com/questions/29879267/es6-class-multiple-inheritance/45332959. Note that none of these provide complete support for multiple inheritence. This is not a feature of the language.