Multiple inheritance in JavaScript

JavascriptFront End TechnologyObject Oriented Programming

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.

raja
Published on 17-Sep-2019 08:45:50
Advertisements