How to Implement Inheritance in JavaScript | Function Constructor Inheritance in JavaScript

Publicado em: 09 January 2023
no canal de: NomadCoder
1,243
44

This video explains how to implement Inheritance in JavaScript. The implementation of Inheritance depends on how objects are created; for instance, inheritance between two object literals is implemented differently than inheritance between function constructors.


The video explains you to implement inheritance in function constructors. To do that, you follow two steps,


Call the parent function constructor indirectly using call or apply the method to assign the common properties.




function Dog(family,name, age){


Animal.call(this,name,age);
this.family = family;
}




Link the prototype of the child function constructor to the prototype of the parent function constructor




Object.setPrototypeOf(Dog.prototype,Animal.prototype);


Please let me know in the comments your feedback and questions.


Nesta página do site você pode assistir ao vídeo on-line How to Implement Inheritance in JavaScript | Function Constructor Inheritance in JavaScript duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário NomadCoder 09 January 2023, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 1,243 vezes e gostou 44 espectadores. Boa visualização!